### Question:
Experiment { boolean cannotRunExperimentsNow () { if (holidayManager.isHoliday()) { log.info("Cannot start an experiment right now. Enjoy the holiday"); return true; } else if (holidayManager.isOutsideWorkingHours()) { log.info("Cannot start an experiment right now. Come back during working hours"); return true; } else if (!adminManager.canRunExperiments()) { log.info("Cannot start an experiment right now. Current admin state is {}", adminManager.getAdminState()); return true; } return false; } Experiment(Container container); String getExperimentMethodName(); Container getContainer(); void setPreferredExperiment(String preferredExperiment); Instant getLastSelfHealingTime(); @JsonIgnore Platform getExperimentLayer(); String getExperimentLayerName(); @JsonIgnore ExperimentMethod getExperimentMethod(); Runnable getSelfHealingMethod(); void setSelfHealingMethod(Runnable selfHealingMethod); @JsonIgnore Runnable getFinalizeMethod(); void setFinalizeMethod(Runnable finalizeMethod); @JsonIgnore Callable<ContainerHealth> getCheckContainerHealth(); void setCheckContainerHealth(Callable<ContainerHealth> checkContainerHealth); void setFinalizationDuration(Duration finalizationDuration); String getId(); ExperimentType getExperimentType(); AtomicInteger getSelfHealingCounter(); ExperimentState getExperimentState(); Instant getStartTime(); void setMinimumDuration(Duration minimumDuration); void setMaximumDuration(Duration maximumDuration); Boolean getWasSelfHealingRequired(); @Override String toString();  }### Answer:
@Test public void cannotRunExperimentsNowDueToHoliday () { doReturn(true).when(holidayManager).isHoliday(); assertTrue(experiment.cannotRunExperimentsNow()); verify(holidayManager).isHoliday(); }
@Test public void cannotRunExperimentsNowDueToWorkingHours () { doReturn(false).when(holidayManager).isHoliday(); doReturn(true).when(holidayManager).isOutsideWorkingHours(); assertTrue(experiment.cannotRunExperimentsNow()); verify(holidayManager).isOutsideWorkingHours(); }
@Test public void cannotRunExperimentsNowDueToAdminState () { doReturn(false).when(holidayManager).isHoliday(); doReturn(false).when(holidayManager).isOutsideWorkingHours(); doReturn(false).when(adminManager).canRunExperiments(); assertTrue(experiment.cannotRunExperimentsNow()); verify(adminManager).canRunExperiments(); }
@Test public void cannotRunExperimentsFalse () { doReturn(false).when(holidayManager).isHoliday(); doReturn(false).when(holidayManager).isOutsideWorkingHours(); doReturn(true).when(adminManager).canRunExperiments(); assertFalse(experiment.cannotRunExperimentsNow()); verify(holidayManager).isHoliday(); verify(holidayManager).isOutsideWorkingHours(); verify(adminManager).canRunExperiments(); }