Package com.google.test.metric

Examples of com.google.test.metric.MethodInvocationCost


  }

  public void testSupressPartialWhenMinCostIs2() throws Exception {
    DrillDownReportGenerator printer =
      new DrillDownReportGenerator(new PrintStream(out), costModel, null, MAX_VALUE, 2);
    methodCost2.addCostSource(new MethodInvocationCost(new SourceLocation(null, 81), methodCost1,
        NON_OVERRIDABLE_METHOD_CALL, Cost.cyclomatic(1)));
    methodCost2.link();
    printer.print("", methodCost2, Integer.MAX_VALUE);
    assertStringEquals("c.g.t.A.method2()V [CC: 3 / CC: 2]\n", out.toString());
  }
View Full Code Here


  }

  public void testSecondLevelRecursive() throws Exception {
    DrillDownReportGenerator printer =
      new DrillDownReportGenerator(new PrintStream(out), costModel, null, MAX_VALUE, 0);
    methodCost3.addCostSource(new MethodInvocationCost(new SourceLocation(null, 1), methodCost2,
        NON_OVERRIDABLE_METHOD_CALL, Cost.cyclomatic(2)));
    methodCost2.addCostSource(new MethodInvocationCost(new SourceLocation(null, 2), methodCost2,
        NON_OVERRIDABLE_METHOD_CALL, new Cost()));
    methodCost3.link();
    printer.print("", methodCost3, 10);
    assertStringEquals("c.g.t.A.method3()V [CC: 5 / CC: 3]\n" +
      "  line 1: c.g.t.A.method2()V [CC: 2 / CC: 2] " + NON_OVERRIDABLE_METHOD_CALL + "\n",
View Full Code Here

    }

    boolean issuesFound = false;
    for (ViolationCost violationCost : methodCost.getViolationCosts()) {
      if (violationCost instanceof MethodInvocationCost) {
        MethodInvocationCost invocationCost = (MethodInvocationCost) violationCost;
        if (invocationCost.getCostSourceType() != IMPLICIT_STATIC_INIT) {
          issuesFound = addMethodInvocationIssues(classIssues, methodCost, classCost, issuesFound,
              invocationCost);
        }
      }
    }
View Full Code Here

    cost.addCostSource(new GlobalCost(new SourceLocation(null, 0), null, Cost.global(1)));
    MethodCost cost3 = new MethodCost("", "b", 0, false, false, false);
    cost3.addCostSource(new CyclomaticCost(new SourceLocation(null, 0), Cost.cyclomatic(1)));
    cost3.addCostSource(new CyclomaticCost(new SourceLocation(null, 0), Cost.cyclomatic(1)));
    cost3.addCostSource(new CyclomaticCost(new SourceLocation(null, 0), Cost.cyclomatic(1)));
    cost.addCostSource(new MethodInvocationCost(new SourceLocation(null, 0), cost3,
        IMPLICIT_STATIC_INIT, Cost.cyclomatic(3)));
    CostModel costModel = new CostModel(2, 10, 1);
    cost.link();

    assertEquals((long) 2 * (3 + 1) + 10 * 1, costModel.computeOverall(cost.getTotalCost()));
View Full Code Here

TOP

Related Classes of com.google.test.metric.MethodInvocationCost

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.