Experiments implements Closeable { public Treatment getActiveTreatment(String experimentName, Identity identity) { strategy.onCacheRead(experimentName, context); final Experiment experiment = cache.getActiveExperiments().get(experimentName); final AttributesMap attributes = identity .computeAttributes() .filter(Identity.getSupportedAttributes(identity.getClass())); if (experiment == null || !experiment.getFilter().evaluate(attributes)) { return null; } return getTreatmentWithOverrides(experiment, identity, attributes); } private  Experiments(ExperimentsStoreProvider provider,
                        CacheStrategy strategy,
                        ExecutorService executorService); static Builder using(ExperimentsStoreProvider provider); Treatment getActiveTreatment(String experimentName, Identity identity); Iterable<Experiment> getActiveExperiments(); Map<Experiment, Treatment> getActiveTreatments(Identity identity); Iterable<Experiment> find(Filter filter); Iterable<Experiment> find(); Experiment get(String experimentName); void delete(String experimentName); void save(Experiment experiment); Experiment create(String name); @Override void close();  }
@Test public void testGetActiveTreatment() { final Identity identity = mock(Identity.class); final Experiment experiment = mock(Experiment.class); doReturn(AttributesMap.empty()).when(identity).computeAttributes(); doReturn(FilterExpression.alwaysTrue()).when(experiment).getFilter(); doReturn(ImmutableMap.of("foo", experiment)) .when(cache) .getActiveExperiments(); experiments.getActiveTreatment("foo", identity); verifyZeroInteractions(store); verify(cache).getActiveExperiments(); }