Skip to content

Commit

Permalink
(cqfn#215) LCOM4 static fields are now called by FQN (rounding error …
Browse files Browse the repository at this point in the history
…as a param)
  • Loading branch information
ilyakharlamov committed Jan 25, 2019
1 parent 63e7dc8 commit 1712cc7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/test/java/org/jpeek/metrics/Lcom4Test.java
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public void methodMethodCalls() throws Exception {
).size()
);
report.assertVariable(Lcom4Test.ATTRIBUTES, 1);
report.assertValue(1.0f);
report.assertValue(1.0f, 0.001);
}

/**
Expand All @@ -126,7 +126,7 @@ public void oneCommonAttribute() throws Exception {
);
report.assertVariable(Lcom4Test.ATTRIBUTES, 1);
report.assertVariable(Lcom4Test.PAIRS, 1);
report.assertValue(1.0f);
report.assertValue(1.0f, 0.001d);
}

/**
Expand All @@ -146,7 +146,7 @@ public void notCommonAttributes() throws Exception {
);
report.assertVariable(Lcom4Test.ATTRIBUTES, 2);
report.assertVariable(Lcom4Test.PAIRS, 0);
report.assertValue(2.0f);
report.assertValue(2.0f, 0.001);
}

/**
Expand Down
6 changes: 3 additions & 3 deletions src/test/java/org/jpeek/metrics/MetricBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,10 @@ public void assertVariable(final String variable,
/**
* Asserts the main metric value.
* @param value Expected value of the metric
* @param error Rounding tolerance since the metric is float number
* @throws Exception String format exception
*/
public void assertValue(final double value) throws Exception {
public void assertValue(final double value, double error) {
new Assertion<>(
"The metric value is not calculated properly",
() -> Double.parseDouble(
Expand All @@ -148,8 +149,7 @@ public void assertValue(final double value) throws Exception {
),
new IsCloseTo(
value,
// @checkstyle MagicNumberCheck (1 line)
0.001d
error
)
).affirm();
}
Expand Down

0 comments on commit 1712cc7

Please sign in to comment.