Created
August 3, 2010 03:30
-
-
Save hakanai/505783 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import org.hamcrest.Matchers; | |
| public class WtfHamcrest { | |
| @Test | |
| public void testWtfHamcrest() | |
| { | |
| Integer a = 1; | |
| String b = "2"; | |
| assertThat(a, Matchers.<Object>is(not(equalTo(b)))); | |
| assertThat(b, Matchers.<Object>is(not(equalTo(a)))); | |
| /* | |
| java.lang.AssertionError: | |
| Expected: is <not "2"> | |
| got: <1> | |
| */ | |
| } | |
| } |
Author
Author
Declaring both variables as Object also fixes it.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Turns out that removing the is() fixes this.