@Test @TestForIssue(jiraKey = "HSEARCH-1547") public void testRequestingServiceAfterReleaseAllThrowsException() { SimpleService simpleService1 = serviceManagerUnderTest.requestService( SimpleService.class ); assertNotNull( "The service should be created", simpleService1 ); serviceManagerUnderTest.releaseService( SimpleService.class ); serviceManagerUnderTest.releaseAllServices(); thrown.expect( IllegalStateException.class ); thrown.expectMessage( JUnitMatchers.containsString( "HSEARCH000209" ) ); serviceManagerUnderTest.requestService( SimpleService.class ); }
@Test @TestForIssue(jiraKey = "HSEARCH-1589") public void testStopServiceIsPerformedLazily() { StoppableService service = serviceManagerUnderTest.requestService( StoppableService.class ); assertNotNull( "The service should be created", service ); assertTrue( service instanceof StoppableServiceImpl ); serviceManagerUnderTest.releaseService( StoppableService.class ); assertFalse( "Service should not be stopped yet", ( (StoppableServiceImpl) service ).isStopped() ); serviceManagerUnderTest.releaseAllServices(); assertTrue( "Service should have been stopped", ( (StoppableServiceImpl) service ).isStopped() ); }