JUnit Assertions

  • assertEquals - Checks that two values are equal. Be careful with objects and doubles
  • assertTrue/assertFalse - Checks that a value is true or false
  • assertThrows - Checks that some code throws an exception
  • ... many more
  • assertions often take a string argument to give more context for what a failure means

15 / 21