when(pastMeasuresLoader.getPastMeasures(dir, pastSnapshot3)).thenReturn(Arrays.<Object[]>asList(
new Object[] {NCLOC_ID, null, null, null, 240.0}));
// current analysis
DecoratorContext context = mock(DecoratorContext.class);
Measure currentNcloc = newMeasure(NCLOC, 200.0);
Measure currentCoverage = newMeasure(COVERAGE, 80.0);
when(context.getMeasures(Matchers.<MeasuresFilter>anyObject())).thenReturn(Arrays.asList(currentNcloc, currentCoverage));
VariationDecorator decorator = new VariationDecorator(pastMeasuresLoader, mock(MetricFinder.class), Arrays.asList(pastSnapshot1, pastSnapshot3), mock(RuleFinder.class));
decorator.decorate(dir, context);
// context updated for each variation : 2 times for ncloc and 1 time for coverage
verify(context, times(3)).saveMeasure(Matchers.<Measure>anyObject());
assertThat(currentNcloc.getVariation1()).isEqualTo(20.0);
assertThat(currentNcloc.getVariation2()).isNull();
assertThat(currentNcloc.getVariation3()).isEqualTo(-40.0);
assertThat(currentCoverage.getVariation1()).isEqualTo(5.0);
assertThat(currentCoverage.getVariation2()).isNull();
assertThat(currentCoverage.getVariation3()).isNull();
}