ApplicationDeployer { public void deploy() { List<ApplicationContent> applications = applicationLoader.loadApplications(); for (ApplicationContent application : applications) { for (ApplicationEntryDeployer deployer : deployers) { deployer.deployEntries(application); } } } ApplicationDeployer(ApplicationService applicationLoader,
                               List<ApplicationEntryDeployer> deployers); void deploy();  }
@Test public void shouldDelegateDeployToEntryDeployers() { ApplicationContent firstApp = mock(ApplicationContent.class); ApplicationContent secondApp = mock(ApplicationContent.class); given(applicationLoader.loadApplications()).willReturn(Arrays.asList(firstApp, secondApp)); deployer.deploy(); verify(firstDeployer).deployEntries(firstApp); verify(firstDeployer).deployEntries(secondApp); verify(secondDeployer).deployEntries(firstApp); verify(secondDeployer).deployEntries(secondApp); }