I run the following test in my Eclipse (with arguments -ea):
public class ColorHelperTest { @Rule public ExpectedException thrown = ExpectedException.none(); @Test public void testGetColorByString() { thrown.expect(AssertionError.class); assert 1 == 2; } } The output is:
java.lang.AssertionError at de.*.*.*.mytests.ColorHelperTest.testGetColorByString(ColorHelperTest.java:28) 28 is the line assert 1==2
Why does this test fail?