test_class.declarator: context = new JUnitRuleMockery()
test_class.modifier: @Rule
      public final
test_class.original_string: @Rule
      public final JUnitRuleMockery context = new JUnitRuleMockery();
test_class.type: JUnitRuleMockery
test_class.var_name: context
test_class.file: mubench/src/test/java/de/tu_darmstadt/stg/mudetect/ranking/WeightRankingStrategyTest.java
test_class.identifier: WeightRankingStrategyTest
test_case.body: @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")));
      }
test_case.class_method_signature: WeightRankingStrategyTest.ranksViolationsWithSameConfidenceByTargetName()
test_case.full_signature: @Test public void ranksViolationsWithSameConfidenceByTargetName()
test_case.identifier: ranksViolationsWithSameConfidenceByTargetName
test_case.invocations: someOverlap somePattern someAUG someOverlap somePattern someAUG someOverlap somePattern someAUG addViolation addViolation addViolation mock mock checking getWeight allowing with any with same with same will returnValue getFormula allowing with any with same with same will returnValue rankViolations assertThat contains
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void ranksViolationsWithSameConfidenceByTargetName()
focal_class.declarator: VIOLATION_COMPARATOR = Comparator
              .comparingDouble(Violation::getConfidence).reversed()
              .thenComparing(v -> v.getLocation().getMethodSignature())
focal_class.modifier: private final
focal_class.original_string: private final Comparator<Violation> VIOLATION_COMPARATOR = Comparator
              .comparingDouble(Violation::getConfidence).reversed()
              .thenComparing(v -> v.getLocation().getMethodSignature());
focal_class.type: Comparator<Violation>
focal_class.var_name: VIOLATION_COMPARATOR
focal_class.declarator: weightFunction
focal_class.modifier: private
focal_class.original_string: private ViolationWeightFunction weightFunction;
focal_class.type: ViolationWeightFunction
focal_class.var_name: weightFunction
focal_class.file: mubench/src/main/java/de/tu_darmstadt/stg/mudetect/ranking/WeightRankingStrategy.java
focal_class.identifier: WeightRankingStrategy
focal_class.interfaces: implements ViolationRankingStrategy
focal_class.class_method_signature: WeightRankingStrategy.WeightRankingStrategy(ViolationWeightFunction weightFunction)
focal_class.full_signature: public  WeightRankingStrategy(ViolationWeightFunction weightFunction)
focal_class.identifier: WeightRankingStrategy
focal_class.modifiers: public
focal_class.parameters: (ViolationWeightFunction weightFunction)
focal_class.signature:  WeightRankingStrategy(ViolationWeightFunction weightFunction)
focal_class.class_method_signature: WeightRankingStrategy.rankViolations(Overlaps overlaps, Model model)
focal_class.full_signature: @Override public List<Violation> rankViolations(Overlaps overlaps, Model model)
focal_class.identifier: rankViolations
focal_class.modifiers: @Override public
focal_class.parameters: (Overlaps overlaps, Model model)
focal_class.return: List<Violation>
focal_class.signature: List<Violation> rankViolations(Overlaps overlaps, Model model)
focal_class.class_method_signature: WeightRankingStrategy.toList(PriorityQueue<Violation> violations)
focal_class.full_signature: private List<Violation> toList(PriorityQueue<Violation> violations)
focal_class.identifier: toList
focal_class.modifiers: private
focal_class.parameters: (PriorityQueue<Violation> violations)
focal_class.return: List<Violation>
focal_class.signature: List<Violation> toList(PriorityQueue<Violation> violations)
focal_method.body: @Override
      public List<Violation> rankViolations(Overlaps overlaps, Model model) {
          PriorityQueue<Violation> violations = new PriorityQueue<>(VIOLATION_COMPARATOR);
          for (Overlap violation : overlaps.getViolations()) {
              double confidence = weightFunction.getWeight(violation, overlaps, model);
              String confidenceString = weightFunction.getFormula(violation, overlaps, model);
              violations.add(new Violation(violation, confidence, confidenceString));
          }
          return toList(violations);
      }
focal_method.class_method_signature: WeightRankingStrategy.rankViolations(Overlaps overlaps, Model model)
focal_method.full_signature: @Override public List<Violation> rankViolations(Overlaps overlaps, Model model)
focal_method.identifier: rankViolations
focal_method.invocations: getViolations getWeight getFormula add toList
focal_method.modifiers: @Override public
focal_method.parameters: (Overlaps overlaps, Model model)
focal_method.return: List<Violation>
focal_method.signature: List<Violation> rankViolations(Overlaps overlaps, Model model)