@Test
public void testEvaluate() {

    
    SimpleBusinessValuesEvaluator bvEval = new SimpleBusinessValuesEvaluator();
    bvEval.setCompensationRepository(new DummyViolationRepository(Arrays.asList(violations)));
    IGuaranteeTerm term = contract.getGuaranteeTerms().get(0);
    
    List<? extends ICompensation> compensations;
    
    for (int i = 0; i < times.length; i++) {
        Date now = new Date(i * 1000);
        
        List<IViolation> newViolations = (times[i] != 0)?
            Collections.singletonList(TestAgreementFactory.newViolation(contract, term, null, now)) :
            Collections.<IViolation>emptyList();
        compensations = bvEval.evaluate(
            contract, 
            term, 
            newViolations,
            now
        );
        for (IPenaltyDefinition def : contract.getGuaranteeTerms().get(0).getBusinessValueList().getPenalties()) {
            int count = def.getCount();
            int step = (int)def.getTimeInterval().getTime() / 1000;
            
            boolean expectedPenalty = sum(times, i - step, i) >= count;
            boolean actualPenalty = foundPenaltyDefinition(def, compensations);
            
            if (expectedPenalty != actualPenalty) {
                assertEquals(expectedPenalty, actualPenalty);
            }
            assertEquals(expectedPenalty, actualPenalty);
        }
    }
}