mkodekar / guava-libraries

Automatically exported from code.google.com/p/guava-libraries
Apache License 2.0
0 stars 0 forks source link

ClassSanityTester.testNulls fails on equals #1819

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 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.

Original issue reported on code.google.com by ogregoire on 29 Jul 2014 at 3:35

Attachments:

GoogleCodeExporter commented 9 years ago
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.

Original comment by ogregoire on 30 Jul 2014 at 3:21

GoogleCodeExporter commented 9 years ago
This issue has been migrated to GitHub.

It can be found at https://github.com/google/guava/issues/<issue id>

Original comment by cgdecker@google.com on 1 Nov 2014 at 4:08

GoogleCodeExporter commented 9 years ago

Original comment by cgdecker@google.com on 1 Nov 2014 at 4:17

GoogleCodeExporter commented 9 years ago

Original comment by cgdecker@google.com on 3 Nov 2014 at 9:07