Type a JUnit 5 test method with AAA structure
Type a JUnit 5 test method with AAA structure
Answer
@Test void add_returnsSum() { int result = calc.add(3, 4); assertEquals(7, result); }
@Test marks this as a test case. assertEquals(expected, actual) fails the test if the values differ. The method name describes the scenario — the test output reads like a specification.