@Test public void testServiceNodeIsDeletedWhenRegistryIsClosed() throws Exception { ZooKeeperPersistentEphemeralNode node = mock(ZooKeeperPersistentEphemeralNode.class); when(_nodeFactory.create(anyString(), any(byte[].class))).thenReturn(node); _registry.register(FOO); _registry.close(); verify(node).close(anyLong(), any(TimeUnit.class)); }
@Test(expected = IllegalStateException.class) public void testUnregisterAfterClose() throws Exception { _registry.close(); _registry.unregister(FOO); }
@After public void teardown() throws Exception { _registry.close(); }