@Test public void forceGetNextPlatformForExperiments2 () { doReturn(false).when(platform1).hasEligibleContainersForExperiments(); final Optional<Platform> nextPlatformForExperiment = platformManager.getNextPlatformForExperiment(true); assertTrue(nextPlatformForExperiment.isPresent()); assertSame(nextPlatformForExperiment.get(), platform2); }
public Optional<Platform> getNextPlatformForExperiment (boolean force) { return getPlatforms().stream() .sorted(comparingLong(platform -> platform.getNextChaosTime().toEpochMilli())) .filter(platform1 -> force || platform1.canExperiment()) .filter(Platform::hasEligibleContainersForExperiments) .findFirst(); }
PlatformManager { public Optional<Platform> getNextPlatformForExperiment (boolean force) { return getPlatforms().stream() .sorted(comparingLong(platform -> platform.getNextChaosTime().toEpochMilli())) .filter(platform1 -> force || platform1.canExperiment()) .filter(Platform::hasEligibleContainersForExperiments) .findFirst(); } }
PlatformManager { public Optional<Platform> getNextPlatformForExperiment (boolean force) { return getPlatforms().stream() .sorted(comparingLong(platform -> platform.getNextChaosTime().toEpochMilli())) .filter(platform1 -> force || platform1.canExperiment()) .filter(Platform::hasEligibleContainersForExperiments) .findFirst(); } @Autowired  PlatformManager();   PlatformManager(Collection<Platform> platforms); }
PlatformManager { public Optional<Platform> getNextPlatformForExperiment (boolean force) { return getPlatforms().stream() .sorted(comparingLong(platform -> platform.getNextChaosTime().toEpochMilli())) .filter(platform1 -> force || platform1.canExperiment()) .filter(Platform::hasEligibleContainersForExperiments) .findFirst(); } @Autowired  PlatformManager();   PlatformManager(Collection<Platform> platforms); Collection<Platform> getPlatforms(); Optional<Platform> getNextPlatformForExperiment(boolean force); }
PlatformManager { public Optional<Platform> getNextPlatformForExperiment (boolean force) { return getPlatforms().stream() .sorted(comparingLong(platform -> platform.getNextChaosTime().toEpochMilli())) .filter(platform1 -> force || platform1.canExperiment()) .filter(Platform::hasEligibleContainersForExperiments) .findFirst(); } @Autowired  PlatformManager();   PlatformManager(Collection<Platform> platforms); Collection<Platform> getPlatforms(); Optional<Platform> getNextPlatformForExperiment(boolean force);  }