DestroyPoolCommand extends OsgiCommandSupport { @VisibleForTesting void setBusinessKey(String businessKey) { this.businessKey = businessKey; } DestroyPoolCommand(List<Provisionr> services, ProcessEngine processEngine);   }
@Test public void testDestroyPool() throws Exception { Provisionr service = mock(Provisionr.class); when(service.getId()).thenReturn(TEST_PROVISIONR_ID); ProcessEngine processEngine = mockProcessEngine(PROCESS_INSTANCE_ID, TEST_BUSINESS_KEY, TEST_PROVISIONR_ID); DestroyPoolCommand command = new DestroyPoolCommand(ImmutableList.of(service), processEngine); command.setBusinessKey(TEST_BUSINESS_KEY); CommandSession session = mock(CommandSession.class); command.execute(session); verify(service).destroyPool(TEST_BUSINESS_KEY); }
@Test(expected = NoSuchElementException.class) public void testFailsWithAnEmptyServiceList() throws Exception { ProcessEngine processEngine = mockProcessEngine(PROCESS_INSTANCE_ID, TEST_BUSINESS_KEY, TEST_PROVISIONR_ID); DestroyPoolCommand command = new DestroyPoolCommand(ImmutableList.<Provisionr>of(), processEngine); CommandSession session = mock(CommandSession.class); command.setBusinessKey(TEST_BUSINESS_KEY); command.execute(session); }