@Test public void testDoServiceFailsNoRestart() throws Exception { doThrow(new ServiceException("Expected")).when(mockFailingService).doService(any(AdaptrisMessage.class)); when(mockFailingService.getUniqueId()).thenReturn(FIRST_SERVICE_ID); when(mockFailingService.createName()).thenReturn(Service.class.getName()); when(mockOutOfStateHandler.isInCorrectState(mockFailingService)).thenReturn(true); BranchingServiceCollection services = createServiceCollection(); services.setOutOfStateHandler(mockOutOfStateHandler); services.setFirstServiceId(FIRST_SERVICE_ID); services.setRestartAffectedServiceOnException(false); services.addService(mockFailingService); AdaptrisMessage msg = AdaptrisMessageFactory.getDefaultInstance().newMessage(); try { services.doService(msg); fail("Mock service should fail."); } catch (ServiceException expected) { verify(mockFailingService, never()).requestStop(); verify(mockFailingService, never()).requestClose(); verify(mockFailingService, never()).requestInit(); verify(mockFailingService, never()).requestStart(); } }
public void setFirstServiceId(String s) { firstServiceId = Args.notBlank(s, "firstServiceId"); }
BranchingServiceCollection extends ServiceCollectionImp { public void setFirstServiceId(String s) { firstServiceId = Args.notBlank(s, "firstServiceId"); } }
BranchingServiceCollection extends ServiceCollectionImp { public void setFirstServiceId(String s) { firstServiceId = Args.notBlank(s, "firstServiceId"); } BranchingServiceCollection();  BranchingServiceCollection(Collection<Service> list); }
BranchingServiceCollection extends ServiceCollectionImp { public void setFirstServiceId(String s) { firstServiceId = Args.notBlank(s, "firstServiceId"); } BranchingServiceCollection();  BranchingServiceCollection(Collection<Service> list); String getFirstServiceId(); void setFirstServiceId(String s); BranchingServiceCollection withFirstServiceId(String s); }
BranchingServiceCollection extends ServiceCollectionImp { public void setFirstServiceId(String s) { firstServiceId = Args.notBlank(s, "firstServiceId"); } BranchingServiceCollection();  BranchingServiceCollection(Collection<Service> list); String getFirstServiceId(); void setFirstServiceId(String s); BranchingServiceCollection withFirstServiceId(String s);  }