I have a JUnit test case here to test a simple class. Basically the class contains just one method called \'sum\' that returns the sum of two numbers. To test if this is right I
assertEquals is a void method. You cannot put the result to variable. But you can get the exception with try/catch block.
assertEquals
void
try/catch
try{ assertEquals("foo", "foo1"); //will fail } catch(AssertionError e){ String message = e.getMessage(); //do whatever you want with e }