Skip to content

Commit

Permalink
Add tests for disposing publishers, services, and clients
Browse files Browse the repository at this point in the history
Signed-off-by: Jacob Perron <[email protected]>
  • Loading branch information
jacobperron committed Jun 24, 2020
1 parent c8ae3e7 commit 7972639
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,16 @@ public final void testAdd() throws Exception {
// Check the contents of the response
assertEquals(5, response.getSum());

// Cleanup
assertEquals(1, node.getClients().size());
assertEquals(1, node.getServices().size());

// We expect that calling dispose should result in a zero handle
// and the reference is dropped from the Node
client.dispose();
assertEquals(0, client.getHandle());
assertEquals(0, node.getClients().size());
service.dispose();
assertEquals(0, service.getHandle());
assertEquals(0, node.getServices().size());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,14 @@ public final void testCreate() {
assertEquals(node.getHandle(), publisher.getNodeReference().get().getHandle());
assertNotEquals(0, publisher.getNodeReference().get().getHandle());
assertNotEquals(0, publisher.getHandle());
assertEquals(1, node.getPublishers().size());

// We expect that calling dispose should result in a zero handle
// and the reference is dropped from the Node
publisher.dispose();
assertEquals(0, publisher.getHandle());
assertEquals(0, node.getPublishers().size());

RCLJava.shutdown();
}
}

0 comments on commit 7972639

Please sign in to comment.