@Test public void getExperimentByUUID () { String uuid = "this is just another random UUID"; Experiment matchingExperiment = experimentManager.addExperiment(mock(Experiment.class)); Experiment nonMatchingexperiment = experimentManager.addExperiment(mock(Experiment.class)); doReturn(uuid).when(matchingExperiment).getId(); doReturn(uuid + " that doesn't match").when(nonMatchingexperiment).getId(); assertSame(matchingExperiment, experimentManager.getExperimentByUUID(uuid)); assertNull(experimentManager.getExperimentByUUID(" with an extra string on the end to get a null")); }
Experiment getExperimentByUUID (String uuid) { return allExperiments.stream().filter(experiment -> experiment.getId().equals(uuid)).findFirst().orElse(null); }
ExperimentManager { Experiment getExperimentByUUID (String uuid) { return allExperiments.stream().filter(experiment -> experiment.getId().equals(uuid)).findFirst().orElse(null); } }
ExperimentManager { Experiment getExperimentByUUID (String uuid) { return allExperiments.stream().filter(experiment -> experiment.getId().equals(uuid)).findFirst().orElse(null); }  }
ExperimentManager { Experiment getExperimentByUUID (String uuid) { return allExperiments.stream().filter(experiment -> experiment.getId().equals(uuid)).findFirst().orElse(null); }  void setExperimentBackoffPeriod(Duration experimentBackoffPeriod); boolean areExperimentsInProgress(); }
ExperimentManager { Experiment getExperimentByUUID (String uuid) { return allExperiments.stream().filter(experiment -> experiment.getId().equals(uuid)).findFirst().orElse(null); }  void setExperimentBackoffPeriod(Duration experimentBackoffPeriod); boolean areExperimentsInProgress();  }