JUnit testing

Test two instances of object are equal

If you want deep equality, you can use Commons Lang3 EqualsBuilder#reflectionEquals():

https://commons.apache.org/proper/commons-lang/javadocs/api-3.1/org/apache/commons/lang3/builder/EqualsBuilder.html#reflectionEquals(java.lang.Object,%20java.lang.Object,%20java.lang.String...)

Assert.assertTrue(EqualsBuilder.reflectionEquals(expected,actual));

KNOWLEDGE GAP - LEARN MORE

  1. https://stackoverflow.com/questions/29076981/how-to-intercept-slf4j-with-logback-logging-via-a-junit-test

Tags

  1. JUnit testing - check for exceptions
  2. JUnit testing - ExtendWith

Links to this note