### Question:
ExperimentManager { void runExperimentSteps (Experiment experiment) { try (AutoCloseableMDCCollection ignored = getExperimentAutoCloseableMDCCollection(experiment)) { if (experiment.getExperimentState().equals(CREATED)) experiment.startExperiment(); if (experiment.getExperimentState().equals(STARTING)) experiment.confirmStartupComplete(); if (experiment.getExperimentState().equals(STARTED)) experiment.evaluateRunningExperiment(); if (experiment.getExperimentState().equals(SELF_HEALING)) experiment.callSelfHealing(); if (experiment.getExperimentState().equals(FINALIZING)) experiment.callFinalize(); if (experiment.getExperimentState().equals(FINISHED)) experiment.closeFinishedExperiment(); if (experiment.getExperimentState().equals(FAILED)) experiment.closeFailedExperiment(); log.info("Evaluated experiment: {}", v("experiment", experiment)); } }  void setExperimentBackoffPeriod(Duration experimentBackoffPeriod); boolean areExperimentsInProgress();  }### Answer:
@Test public void runExperimentSteps () { Experiment experiment = experimentManager.addExperiment(mock(Experiment.class)); final ExperimentState[] experimentStates = values(); for (int i = 0; i < experimentStates.length; i++) { doReturn(experimentStates[i]).when(experiment).getExperimentState(); experimentManager.runExperimentSteps(experiment); verify(experiment, times(i == 0 ? 1 : 0)).startExperiment(); verify(experiment, times(i == 1 ? 1 : 0)).confirmStartupComplete(); verify(experiment, times(i == 2 ? 1 : 0)).evaluateRunningExperiment(); verify(experiment, times(i == 3 ? 1 : 0)).callSelfHealing(); verify(experiment, times(i == 4 ? 1 : 0)).callFinalize(); verify(experiment, times(i == 5 ? 1 : 0)).closeFinishedExperiment(); verify(experiment, times(i == 6 ? 1 : 0)).closeFailedExperiment(); reset(experiment); } }