I have the following code in one of my tests. The second assertion fails.
String decode1 = URLDecoder.decode("a%20b", "UTF-8");
assertTrue("a b".equals(decode1)); // pass
assertEquals("a b", decode1); // FAIL
I can’t figure out why. Is this a bug with JUnit? You would think that JUnit would just call .equals() if the first arg is not null…
When I pasted your code into a new test, it fails as you stated. However, after deleting the final “a b” string and retyping it, it passed. You must have some embedded characters in there that I don’t see when viewing the source of this page.
The failed assertion shows this somewhat by saying the expected value is