====== JUnit ====== [[JUnit 5]] ===== Articles ===== [[JUnit Best Practices]] by Kyle Blaney ===== AssertJ ===== A better alternative to JUnit assertions is : [[http://joel-costigliola.github.io/assertj/|AssertJ]] Examples for ''Assertions.assertThat()'': assertThat(frodo.age).isEqualTo(33); assertThat(frodo.getName()).isEqualTo("Frodo").isNotEqualTo("Frodon"); assertThat(frodo).isIn(fellowshipOfTheRing); assertThat(frodo).isIn(sam, frodo, pippin); assertThat(sauron).isNotIn(fellowshipOfTheRing); assertThat(frodo).matches(p -> p.age > 30 && p.getRace() == HOBBIT); assertThat(frodo.age).matches(p -> p > 30); Examples for ''BDDAssertions.then()'': then(frodo.age).isEqualTo(33); then(frodo.getName()).isEqualTo("Frodo").isNotEqualTo("Frodon"); then(frodo).isIn(fellowshipOfTheRing); then(frodo).isIn(sam, frodo, pippin); then(sauron).isNotIn(fellowshipOfTheRing); then(frodo).matches(p -> p.age > 30 && p.getRace() == HOBBIT); then(frodo.age).matches(p -> p > 30);