Package com.google.test.metric.report.Source

Examples of com.google.test.metric.report.Source.Line


    ClassReport classReport = report.createClassReport(classCost);
    Source source = classReport.getSource();
    MethodCost m1 = classCost.getMethodCost("void m1()");
    MethodCost m2 = classCost.getMethodCost("void m2()");
    Line l1 = source.getLine(m1.getMethodLineNumber());
    Line l2 = source.getLine(m2.getMethodLineNumber());

    assertTrue(l1.toString(), l1.toString().contains("staticCost4()"));
    assertEquals(4, l1.getCost().getCyclomaticComplexityCost());
    assertTrue(l2.toString(), l2.toString().contains("staticCost3()"));
    assertEquals(3, l2.getCost().getCyclomaticComplexityCost());
  }
View Full Code Here


    IssuesReporter reporter = new IssuesReporter(new LinkedList<ClassIssues>(), costModel);
    ReportModel model = new AboutTestabilityReport(reporter, new SourceLoader(null) {
      @Override
      public Source load(String name) {
        return new Source(asList(
            new Line(1, "Copyright garbage!"),
            new Line(2, "package com.google.test.metric.example;"),
            new Line(3, "import java.util.List;"),
            new Line(4, "  "),
            new Line(5, "class SumOfPrimes {"),
            new Line(6, "  public void sum() {}"),
            new Line(7, "}")));
      }
    });
    Configuration configuration = new Configuration();
    configuration.setTemplateLoader(new ClassPathTemplateLoader(ReportGeneratorProvider.PREFIX));
    BeansWrapper objectWrapper = new DefaultObjectWrapper();
View Full Code Here

    for (MethodCost method : classCost.getMethods()) {
      int overallCost = costModel.computeOverall(method.getTotalCost());
      classReport.addMethod(method.getMethodName(), method
          .getMethodLineNumber(), overallCost, method.getTotalCost(), method
          .getCost());
      Line line = source.getLine(method.getMethodLineNumber());
      line.addMethodCost(method);
      for (ViolationCost violation : method.getExplicitViolationCosts()) {
        line = source.getLine(violation.getLocation().getLineNumber());
        line.addCost(violation.getCost());
      }
    }
    projectByClassReport.addClass(classCost.getClassName(), classReport
        .getOverallCost());
    return classReport;
View Full Code Here

TOP

Related Classes of com.google.test.metric.report.Source.Line

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.