@Test public void getAssignmentCountsTest() { AssignmentCounts assignmentCounts = mock(AssignmentCounts.class); Experiment experiment = mock(Experiment.class); Experiment.ID id = Experiment.ID.newInstance(); when(experimentRepository.getExperiment(eq(id))).thenReturn(experiment); when(assignmentsRepository.getBucketAssignmentCount(eq(experiment))).thenReturn(assignmentCounts); Date date = new Date(1000); when(experiment.getCreationTime()).thenReturn(date); AssignmentCounts result = this.analyticsImpl.getAssignmentCounts(id, null); assertThat(result, is(assignmentCounts)); date = new Date(); when(experiment.getCreationTime()).thenReturn(date); result = this.analyticsImpl.getAssignmentCounts(id, null); assertThat(result, is(assignmentCounts)); }
@Override public AssignmentCounts getAssignmentCounts(Experiment.ID experimentID, Context context) { Experiment experiment = cassandraRepository.getExperiment(experimentID); if (Objects.isNull(experiment)) { throw new ExperimentNotFoundException(experimentID); } return assignmentRepository.getBucketAssignmentCount(experiment); }
AnalyticsImpl implements Analytics { @Override public AssignmentCounts getAssignmentCounts(Experiment.ID experimentID, Context context) { Experiment experiment = cassandraRepository.getExperiment(experimentID); if (Objects.isNull(experiment)) { throw new ExperimentNotFoundException(experimentID); } return assignmentRepository.getBucketAssignmentCount(experiment); } }
AnalyticsImpl implements Analytics { @Override public AssignmentCounts getAssignmentCounts(Experiment.ID experimentID, Context context) { Experiment experiment = cassandraRepository.getExperiment(experimentID); if (Objects.isNull(experiment)) { throw new ExperimentNotFoundException(experimentID); } return assignmentRepository.getBucketAssignmentCount(experiment); } @Inject  AnalyticsImpl(final Experiments experiments, final AssignmentsRepository assignmentRepository,
                         final TransactionFactory dataTransactorFactory, final AnalyticsRepository analyticsRepository,
                         final AnalysisTools analysisTools,
                         final @CassandraRepository ExperimentRepository cassandraRepository); }
AnalyticsImpl implements Analytics { @Override public AssignmentCounts getAssignmentCounts(Experiment.ID experimentID, Context context) { Experiment experiment = cassandraRepository.getExperiment(experimentID); if (Objects.isNull(experiment)) { throw new ExperimentNotFoundException(experimentID); } return assignmentRepository.getBucketAssignmentCount(experiment); } @Inject  AnalyticsImpl(final Experiments experiments, final AssignmentsRepository assignmentRepository,
                         final TransactionFactory dataTransactorFactory, final AnalyticsRepository analyticsRepository,
                         final AnalysisTools analysisTools,
                         final @CassandraRepository ExperimentRepository cassandraRepository); @Override ExperimentCounts getExperimentRollup(final Experiment.ID experimentID, final Parameters parameters); @Override ExperimentCounts getExperimentCounts(final Experiment.ID experimentID, final Parameters parameters); @Override ExperimentCumulativeCounts getExperimentRollupDailies(final Experiment.ID experimentID,
                                                                 final Parameters parameters); @Override ExperimentCumulativeCounts getExperimentCountsDailies(final Experiment.ID experimentId, final Parameters parameters); @Override ExperimentStatistics getExperimentStatistics(final Experiment.ID experimentId, final Parameters parameters); @Override ExperimentCumulativeStatistics getExperimentStatisticsDailies(final Experiment.ID experimentId,
                                                                         final Parameters parameters); @Override AssignmentCounts getAssignmentCounts(Experiment.ID experimentID, Context context); }
AnalyticsImpl implements Analytics { @Override public AssignmentCounts getAssignmentCounts(Experiment.ID experimentID, Context context) { Experiment experiment = cassandraRepository.getExperiment(experimentID); if (Objects.isNull(experiment)) { throw new ExperimentNotFoundException(experimentID); } return assignmentRepository.getBucketAssignmentCount(experiment); } @Inject  AnalyticsImpl(final Experiments experiments, final AssignmentsRepository assignmentRepository,
                         final TransactionFactory dataTransactorFactory, final AnalyticsRepository analyticsRepository,
                         final AnalysisTools analysisTools,
                         final @CassandraRepository ExperimentRepository cassandraRepository); @Override ExperimentCounts getExperimentRollup(final Experiment.ID experimentID, final Parameters parameters); @Override ExperimentCounts getExperimentCounts(final Experiment.ID experimentID, final Parameters parameters); @Override ExperimentCumulativeCounts getExperimentRollupDailies(final Experiment.ID experimentID,
                                                                 final Parameters parameters); @Override ExperimentCumulativeCounts getExperimentCountsDailies(final Experiment.ID experimentId, final Parameters parameters); @Override ExperimentStatistics getExperimentStatistics(final Experiment.ID experimentId, final Parameters parameters); @Override ExperimentCumulativeStatistics getExperimentStatisticsDailies(final Experiment.ID experimentId,
                                                                         final Parameters parameters); @Override AssignmentCounts getAssignmentCounts(Experiment.ID experimentID, Context context); static final String PROPERTY_NAME; }