[Johnny Clasrk] IsNull IsNotNull True False Checks and Assertions (IDEA-35808)

This commit is contained in:
peter
2013-02-21 11:17:53 +01:00
parent 87f9d894f7
commit 0e12be8b66
16 changed files with 1821 additions and 0 deletions
@@ -0,0 +1,9 @@
public class AssertFalse {
void bar() {
final boolean b = call();
if (Assertions.assertFalse(b)) {
if(<warning descr="Condition 'b' is always 'false'">b</warning>) {}
}
}
boolean call() {return true;}
}
@@ -0,0 +1,10 @@
import java.lang.*;
public class AssertIsNotNull {
void bar() {
final Object o = call();
Assertions.assertIsNotNull(o);
if(<warning descr="Condition 'o == null' is always 'false'">o == null</warning>) {}
}
Object call() {return new Object();}
}
@@ -0,0 +1,10 @@
import java.lang.*;
public class AssertIsNull {
void bar() {
final Object o = call();
Assertions.assertIsNull(o);
if(<warning descr="Condition 'o == null' is always 'true'">o == null</warning>) {}
}
Object call() {return new Object();}
}
@@ -0,0 +1,9 @@
public class AssertTrue {
void bar() {
final boolean b = call();
if (Assertions.assertTrue(b)) {
if(<warning descr="Condition 'b' is always 'true'">b</warning>) {}
}
}
boolean call() {return true;}
}
@@ -0,0 +1,9 @@
public class IsNotNullCheck {
void bar() {
final Value v = call();
if (Value.isNotNull(v)) {
if(<warning descr="Condition 'v == null' is always 'false'">v == null</warning>) {}
}
}
Value call() {return new Value();}
}
@@ -0,0 +1,9 @@
public class IsNullCheck {
void bar() {
final Value v = call();
if (Value.isNull(v)) {
if(<warning descr="Condition 'v == null' is always 'true'">v == null</warning>) {}
}
}
Value call() {return new Value();}
}