Java AssertNotNull (primitive)

Why: Java will automatically box the primitive and so an assert on a primitive will always succeed. As a result, test methods exist that look like they do something useful but really dont.

Type: bug

Noncompliant code:
boolean x = true;
assertNotNull (x);
x = false;
assertNotNull (x);

Also works for int (I tried this) and presumably other primitive variables.

I came across some tests in a project at work that succeeded but did not actually achieve the goals of the tests. This rule would help us and presumably others.

Thank you very much,
Larry Diamond