Open testmigrator opened 3 months ago
I've just found the exact same issue. IMO, the fix is:
diff --git a/src/main/java/testsmell/smell/MagicNumberTest.java b/src/main/java/testsmell/smell/MagicNumberTest.java
index 6b756ed..c29c18f 100644
--- a/src/main/java/testsmell/smell/MagicNumberTest.java
+++ b/src/main/java/testsmell/smell/MagicNumberTest.java
@@ -52,7 +52,7 @@ public class MagicNumberTest extends AbstractSmell {
testMethod.setSmell(false); //default value is false (i.e. no smell)
super.visit(n, arg);
- testMethod.setSmell(magicCount >= thresholds.getMagicNumberTest());
+ testMethod.setSmell(magicCount > thresholds.getMagicNumberTest());
testMethod.addDataItem("MagicNumberCount", String.valueOf(magicCount));
smellyElementsSet.add(testMethod);
The default threshold is set to 0. Assuming a refactoring has already eliminated the magic number, re-testing should not detect this smell. However, because magicCount = 0 >= 0 (default threshold), the following code will still detect a magic number: