assertEquals(0, methodCost.getTotalCost().getGlobalCost());
assertEquals(12, methodCost.getTotalCost().getCyclomaticComplexityCost());
}
public void testClassCost() throws Exception {
ClassCost classCost = decoratedComputer.compute(MultipleMethodsDifferentCosts.class);
assertEquals(12, classCost.getHighestMethodComplexityCost());
assertEquals(0, classCost.getHighestMethodGlobalCost());
// overall cost is a mysterious numbers that is calculated with a weighted average formula
float weight = 1.5f;
long expectedOverallCost = (long)
((Math.pow(4, weight + 1) * 7 + Math.pow(12, weight + 1))
/
(Math.pow(4, weight) * 7 + Math.pow(12, weight)));
assertEquals(7, expectedOverallCost);
assertEquals(4*7 + 12, classCost.getTotalComplexityCost());
assertEquals(0, classCost.getTotalGlobalCost());
}