Experiment implements Named { public Experiment clearTreatments() { final List<Treatment> toRemove = Lists.newArrayList(treatments.values()); for (final Treatment treatment : toRemove) { removeTreatment(treatment.getName()); } return this; } private  Experiment(Experiments owner,
                       String name,
                       int seed,
                       String description,
                       FilterExpression filter,
                       Set<String> hashAttributes,
                       boolean active,
                       DateTime created,
                       DateTime modified,
                       DateTime activated,
                       DateTime deactivated,
                       Map<String, Treatment> treatments,
                       Iterable<TreatmentOverride> overrides,
                       Iterable<Allocation> allocations); protected  Experiment(Experiments owner, String name); private  Experiment(Experiment toCopy); static Experiment copyOf(Experiment experiment); String getName(); String getDescription(); Experiment setDescription(String description); FilterExpression getFilter(); Set<String> getHashAttributes(); Experiment setFilter(FilterExpression filter); Experiment setHashAttributes(Set<String> hashAttributes); Experiment setHashAttributes(String ... hashAttributes); Experiment setSeed(int seed); int getSeed(); boolean isActive(); DateTime getCreated(); DateTime getModified(); DateTime getActivated(); DateTime getDeactivated(); List<Allocation> getAllocations(); List<Treatment> getTreatments(); Treatment getTreatment(String treatmentName); List<TreatmentOverride> getOverrides(); TreatmentOverride getOverride(String overrideName); Experiment activate(); Experiment deactivate(); Experiment addTreatment(String name); Experiment addTreatment(String name, String description); Experiment clearTreatments(); Experiment clearOverrides(); Experiment addOverride(String overrideName, String treatmentName, String filter); Experiment removeOverride(String overrideName); Experiment removeOverrides(String treatmentName); Experiment removeTreatment(String name); Experiment save(); void delete(); Experiment allocate(String treatmentName, int size); Experiment deallocate(String treatmentName, int size); Experiment reallocate(String sourceTreatmentName, String destinationTreatmentName, int size); Experiment deallocateAll(); Treatment getTreatment(Identity identity, AttributesMap attributes); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString();  }
@Test public void testClearTreatments() throws ValidationException { final Experiment experiment = new Experiment(null, "foo") .addTreatment("bar") .allocate("bar", 10) .addOverride("override", "bar", "true"); assertEquals(1, experiment.getTreatments().size()); assertEquals(1, experiment.getAllocations().size()); assertEquals(1, experiment.getOverrides().size()); experiment.clearTreatments(); assertEquals(0, experiment.getTreatments().size()); assertEquals(0, experiment.getAllocations().size()); assertEquals(0, experiment.getOverrides().size()); }