// This was throwing NPE before
public void testPrintCostNullReason() throws Exception {
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 + "\"/>");