IDEA-155323 Bogus "Test-only method is called" inspection

This commit is contained in:
peter
2016-04-29 22:56:20 +02:00
parent 493794856b
commit 6663489749
4 changed files with 33 additions and 1 deletions
@@ -10,4 +10,15 @@
<line>5</line>
<description>Test-only method is called in production code</description>
</problem>
<problem>
<file>B.java</file>
<line>6</line>
<description>Test-only class is referenced in production code</description>
</problem>
<problem>
<file>B.java</file>
<line>7</line>
<description>Test-only method is called in production code</description>
</problem>
</problems>
@@ -18,4 +18,16 @@ public class A {
void relaxedToPackageLevel(int a) {
}
@com.google.common.annotations.VisibleForTesting
static class FooException extends RuntimeException {
FooException(String message) {
super(message);
}
}
public static void usingExceptionPrivately(String[] args) {
A.FooException exception =
new A.FooException("");
}
}
@@ -3,5 +3,7 @@ public class B {
new A().invisibleMethod(2);
new A().visibleMethod(2);
new A().relaxedToPackageLevel(2);
A.FooException exception =
new A.FooException("");
}
}