@Test
public void ranksViolationsWithSameConfidenceByTargetName() {

    Overlap violation1 = someOverlap(somePattern(), someAUG("target-b"));
    Overlap violation2 = someOverlap(somePattern(), someAUG("target-a"));
    Overlap violation3 = someOverlap(somePattern(), someAUG("target-c"));
    Overlaps overlaps = new Overlaps();
    overlaps.addViolation(violation1);
    overlaps.addViolation(violation2);
    overlaps.addViolation(violation3);
    Model model = context.mock(Model.class);
    ViolationWeightFunction weightFunction = context.mock(ViolationWeightFunction.class);
    context.checking(new Expectations() {{
        allowing(weightFunction).getWeight(with(any(Overlap.class)), with(same(overlaps)), with(same(model))); will(returnValue(1.0));
        allowing(weightFunction).getFormula(with(any(Overlap.class)), with(same(overlaps)), with(same(model))); will(returnValue("1"));
    }});
    ViolationRankingStrategy strategy = new WeightRankingStrategy(weightFunction);
    final List<Violation> violations = strategy.rankViolations(overlaps, model);
    assertThat(violations, contains(
            new Violation(violation2, 1.0, "1"),
            new Violation(violation1, 1.0, "1"),
            new Violation(violation3, 1.0, "1")));
}