Package com.google.test.metric

Examples of com.google.test.metric.ViolationCost


    XMLReportGenerator report = new XMLReportGenerator(handler, costModel, 0, 0, 0);

    MethodCost methodCost = new MethodCost("", "methodName", 1, false, false, false);
    methodCost.addCostSource(new CyclomaticCost(new SourceLocation(null, 0), Cost.cyclomatic(1)));
    methodCost.addCostSource(new CyclomaticCost(new SourceLocation(null, 0), Cost.cyclomatic(1)));
    ViolationCost violation = new MethodInvocationCost(new SourceLocation("source.file", 123), methodCost,
        IMPLICIT_STATIC_INIT, Cost.cyclomatic(2).add(Cost.global(3)));
    report.writeCost(violation);
    assertXMLEquals("<cost cyclomatic=\"2\" file=\"source.file\" global=\"3\" line=\"123\" "
        + "lod=\"0\" method=\"methodName\" overall=\"32\" "
        + "reason=\"implicit cost from static initialization\"/>");
View Full Code Here


    XMLReportGenerator report = new XMLReportGenerator(handler, costModel, 0, 0, 0);

    MethodCost methodCost = new MethodCost("", "methodName", 1, false, false, false);
    methodCost.addCostSource(new CyclomaticCost(new SourceLocation(null, 0), Cost.cyclomatic(1)));
    methodCost.addCostSource(new CyclomaticCost(new SourceLocation(null, 0), Cost.cyclomatic(1)));
    ViolationCost violation = new MethodInvocationCost(new SourceLocation("source.file", 123), methodCost,
        NON_OVERRIDABLE_METHOD_CALL, Cost.cyclomatic(2).add(Cost.global(3)));
    report.writeCost(violation);
    assertXMLEquals("<cost cyclomatic=\"2\" file=\"source.file\" global=\"3\" line=\"123\" "
        + "lod=\"0\" method=\"methodName\" overall=\"32\" "
        + "reason=\"" + NON_OVERRIDABLE_METHOD_CALL + "\"/>");
View Full Code Here

TOP

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

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.