lundi 27 juin 2016

AssertionError vs. ComparisonFailure in JUnit?

I have two nearly identical tests where one throws an AssertionError and the other throws a ComparisonFailure. The only difference seems to be that the AsserationError prints the diff in the console while the ComparisonFailure lets me click to see a pop out window. They are both using the same method (assertThat(actual).isEqualTo(expected)) so I am not sure what can be triggering the different results. What is the difference between these and how do I control which one gets output?

Aucun commentaire:

Enregistrer un commentaire