@Test public void cannotRunExperimentsNowDueToHoliday () { doReturn(true).when(holidayManager).isHoliday(); assertTrue(experiment.cannotRunExperimentsNow()); verify(holidayManager).isHoliday(); }
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 { 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 { 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); }
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(); }
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();  }