@Test(expected = IllegalArgumentException.class) public void testExperimentLabelStartEndNull() { Experiment experiment = Experiment.withID(Experiment.ID.newInstance()) .withDescription(DUMMY_DESCRIPTION).build(); experiment.setState(Experiment.State.DRAFT); experimentValidator.validateExperiment(experiment); }
public void validateExperiment(Experiment experiment) { Experiment.State state = experiment.getState(); if (state.equals(Experiment.State.DELETED) || state.equals(Experiment.State.TERMINATED)) { return; } validateLabel(experiment.getLabel()); validateExperimentStartEnd(experiment.getStartTime(), experiment.getEndTime()); validateSamplingPercent(experiment.getSamplingPercent()); validateExperimentRule(experiment.getRule()); validateModelNameNotNullForPersonalizedExperiments(experiment.getIsPersonalizationEnabled() , experiment.getModelName()); }
ExperimentValidator { public void validateExperiment(Experiment experiment) { Experiment.State state = experiment.getState(); if (state.equals(Experiment.State.DELETED) || state.equals(Experiment.State.TERMINATED)) { return; } validateLabel(experiment.getLabel()); validateExperimentStartEnd(experiment.getStartTime(), experiment.getEndTime()); validateSamplingPercent(experiment.getSamplingPercent()); validateExperimentRule(experiment.getRule()); validateModelNameNotNullForPersonalizedExperiments(experiment.getIsPersonalizationEnabled() , experiment.getModelName()); } }
ExperimentValidator { public void validateExperiment(Experiment experiment) { Experiment.State state = experiment.getState(); if (state.equals(Experiment.State.DELETED) || state.equals(Experiment.State.TERMINATED)) { return; } validateLabel(experiment.getLabel()); validateExperimentStartEnd(experiment.getStartTime(), experiment.getEndTime()); validateSamplingPercent(experiment.getSamplingPercent()); validateExperimentRule(experiment.getRule()); validateModelNameNotNullForPersonalizedExperiments(experiment.getIsPersonalizationEnabled() , experiment.getModelName()); } ExperimentValidator(); }
ExperimentValidator { public void validateExperiment(Experiment experiment) { Experiment.State state = experiment.getState(); if (state.equals(Experiment.State.DELETED) || state.equals(Experiment.State.TERMINATED)) { return; } validateLabel(experiment.getLabel()); validateExperimentStartEnd(experiment.getStartTime(), experiment.getEndTime()); validateSamplingPercent(experiment.getSamplingPercent()); validateExperimentRule(experiment.getRule()); validateModelNameNotNullForPersonalizedExperiments(experiment.getIsPersonalizationEnabled() , experiment.getModelName()); } ExperimentValidator(); void validateExperiment(Experiment experiment); void validateNewExperiment(NewExperiment newExperiment); void validateStateTransition(Experiment.State oldState, Experiment.State newState); void validateExperimentBuckets(List<Bucket> buckets); void ensureStateIsDraft(Experiment experiment); void validateBucketStateTransition(Bucket.State oldState, Bucket.State desiredState); void validateDescriptionNotEmpty(String description); }
ExperimentValidator { public void validateExperiment(Experiment experiment) { Experiment.State state = experiment.getState(); if (state.equals(Experiment.State.DELETED) || state.equals(Experiment.State.TERMINATED)) { return; } validateLabel(experiment.getLabel()); validateExperimentStartEnd(experiment.getStartTime(), experiment.getEndTime()); validateSamplingPercent(experiment.getSamplingPercent()); validateExperimentRule(experiment.getRule()); validateModelNameNotNullForPersonalizedExperiments(experiment.getIsPersonalizationEnabled() , experiment.getModelName()); } ExperimentValidator(); void validateExperiment(Experiment experiment); void validateNewExperiment(NewExperiment newExperiment); void validateStateTransition(Experiment.State oldState, Experiment.State newState); void validateExperimentBuckets(List<Bucket> buckets); void ensureStateIsDraft(Experiment experiment); void validateBucketStateTransition(Bucket.State oldState, Bucket.State desiredState); void validateDescriptionNotEmpty(String description);  }