migrator / guava-libraries-2

Guava: Google Core Libraries for Java 1.6+
0 stars 0 forks source link

ClassSanityTester.testNulls fails on equals #6

Open migrator opened 10 years ago

migrator commented 10 years ago

When I call the following, the test case fails (see full test case in attachment).

new ClassSanityTester().testNulls(MyObject.class);

I get the following error: No exception thrown for parameter at index 0 from MyObjectTest$MyObject.public boolean MyObjectTest$MyObject.equals(java.lang.Object)[null] for class MyObjectTest$MyObject

Clearly, this indicates that it expects a call to "equals(Object)" to throw a NullPointerException. That method should never throw an exception but rather return true or false. The test seems to skip this assertion and I'm surprised this hasn't been reported earlier.

Please make it so ClassSanityTester#testNulls(Class) doesn't fail when equals is behaving correctly (see the test case where testEquals(MyObject.class succeeds).

On a side note, the text returned should be adapted as it mentions three times MyObjectTest$MyObject. That's 2 too many, and it renders the whole error message nearly not understandable.

relevance: 1

migrator commented 10 years ago

summary: Not Defined

Okay, I found one issue on my side: the lack of online javadoc available. I had to check in the code online to find out that it's playing nice only if @Nullable is present.

I checked the front-page of Guava and no, there is no link at all to the testlib javadoc. I played a bit with urls and couldn't find any url for the testlib javadoc.

status Not Defined creator: ogregoire created at: Jul 30, 2014