@Test public void getPlatformsOfLevel () { when(platform1.getPlatformLevel()).thenReturn(PlatformLevel.IAAS); when(platform2.getPlatformLevel()).thenReturn(PlatformLevel.PAAS); Collection<Platform> iaasPlatforms = platformManager.getPlatformsOfLevel(PlatformLevel.IAAS); Collection<Platform> paasPlatforms = platformManager.getPlatformsOfLevel(PlatformLevel.PAAS); assertThat(paasPlatforms, not(hasItem(platform1))); assertThat(iaasPlatforms, not(hasItem(platform2))); assertThat(iaasPlatforms, IsIterableContainingInAnyOrder.containsInAnyOrder(platform1)); assertThat(paasPlatforms, IsIterableContainingInAnyOrder.containsInAnyOrder(platform2)); }
Collection<Platform> getPlatformsOfLevel (PlatformLevel platformLevel) { return getPlatforms().stream().filter(platform -> platform.getPlatformLevel() == platformLevel).collect(Collectors.toList()); }
PlatformManager { Collection<Platform> getPlatformsOfLevel (PlatformLevel platformLevel) { return getPlatforms().stream().filter(platform -> platform.getPlatformLevel() == platformLevel).collect(Collectors.toList()); } }
PlatformManager { Collection<Platform> getPlatformsOfLevel (PlatformLevel platformLevel) { return getPlatforms().stream().filter(platform -> platform.getPlatformLevel() == platformLevel).collect(Collectors.toList()); } @Autowired  PlatformManager();   PlatformManager(Collection<Platform> platforms); }
PlatformManager { Collection<Platform> getPlatformsOfLevel (PlatformLevel platformLevel) { return getPlatforms().stream().filter(platform -> platform.getPlatformLevel() == platformLevel).collect(Collectors.toList()); } @Autowired  PlatformManager();   PlatformManager(Collection<Platform> platforms); Collection<Platform> getPlatforms(); Optional<Platform> getNextPlatformForExperiment(boolean force); }
PlatformManager { Collection<Platform> getPlatformsOfLevel (PlatformLevel platformLevel) { return getPlatforms().stream().filter(platform -> platform.getPlatformLevel() == platformLevel).collect(Collectors.toList()); } @Autowired  PlatformManager();   PlatformManager(Collection<Platform> platforms); Collection<Platform> getPlatforms(); Optional<Platform> getNextPlatformForExperiment(boolean force);  }