@Test public myTest() { fail("Test didn't work with parameter=" + parameter); assertEquals("The things are not equal for parameter=" + parameter, thing1, thing2); }
Programming Tips - jUnit: Make jUnit print a message when a test fails
Date: 2014dec2
Update: 2026sep6
Language: Java
Product: jUnit
Context: jUnit is a very commonly used testing framework for Java
Q. jUnit: Make jUnit print a message when a test fails
A. There are alternate versions of most assert functions that will
do just that. eg: