JUnit Testing

  • In Java, JUnit is a very popular testing framework
  • Allows you to write small snippets of test code that "drive" your real code
  • Provides assertion functions to verify that your code worked right
@Test
public void testMyCode() {
    Calculator calc = new Calculator();
    double result = calc.calculate(1, "+", 1);
    assertEquals(2, result)
}

12 / 21