### Question:
ExperimentManager { Experiment createSingleExperiment (Platform platform, String containerIdentifier, String experimentMethod) { Optional<Experiment> optionalExperiment = Optional.of(platform) .map(platform1 -> platform1.getContainerByIdentifier(containerIdentifier)) .map(container -> container.createExperiment(experimentMethod)); optionalExperiment.ifPresentOrElse(experiment -> log.debug("Created experiment {}", v("experiment", experiment)), () -> log .warn("Experiment of type {} could not be created for {} ", kv("experimentMethod", experimentMethod), kv("containerIdentifier", containerIdentifier))); return optionalExperiment.orElse(null); }  void setExperimentBackoffPeriod(Duration experimentBackoffPeriod); boolean areExperimentsInProgress();  }### Answer:
@Test public void createSingletonExperiment () { Container container = mock(Container.class); Experiment experiment = mock(Experiment.class); doReturn(container).when(firstPlatform).getContainerByIdentifier("identifier"); doReturn(experiment).when(container).createExperiment("experimentMethod"); assertSame(experiment, experimentManager.createSingleExperiment(firstPlatform, "identifier", "experimentMethod")); }
@Test public void createSingletonExperimentNullContainer () { doReturn(null).when(firstPlatform).getContainerByIdentifier("identifier"); assertNull(experimentManager.createSingleExperiment(firstPlatform, "identifier", "experimentMethod")); }
@Test public void createSingletonExperimentNullExperiment () { Container container = mock(Container.class); doReturn(container).when(firstPlatform).getContainerByIdentifier("identifier"); doReturn(null).when(container).createExperiment("experimentMethod"); assertNull(experimentManager.createSingleExperiment(firstPlatform, "identifier", "experimentMethod")); }