I wrote a unit test that passes when I run it in Eclipse, but fails when I do "maven install".
I use JUnit 4, Mockito 1.9.5, Maven 3.0.4, JRE 1.7._51, Sunfire 2.15.
The assert that seemingly fails is:
assert string1.equals(string2);
I wrote a unit test that passes when I run it in Eclipse, but fails when I do "maven install".
I use JUnit 4, Mockito 1.9.5, Maven 3.0.4, JRE 1.7._51, Sunfire 2.15.
The assert that seemingly fails is:
assert string1.equals(string2);
Java keyword assert
must be activated to work.
They can be activated at run-time by way of the -ea option on the java command, but are not turned on by default.
For string comparision use equals
assert string1.equals(string2)
Use junit assertions in test
assertEquals(string1, string2)
For best results use AssertJ - Fluent assertions for java
assertThat(string1).isEqualTo(string2);