This Java program contains a refactored and encapsulated Insurance program with an efficient JUnit Test suite.
-
runnerTestSuite runs the test suite.
-
Main, mainClassTest
-
Accident, accidentClassTest
-
Age, ageClassTest
-
Calculator, calculatorClassTest
@BeforeAll - runnerClassTest
@BeforeEach - ageClassTest, mainClassTest, calculatorClassTest
@Test - each ClassTest
@ParameterizedTest - accidentClassTest
@Timeout - ageClassTest
@AfterAll - runnerClassTest
@AfterEach - ageClassTest, mainClassTest, calculatorClassTest
Exceptions: IllegalArgumentExceptionTest - mainClassTest
NullPointerExceptionTest - mainClassTest
- Install testing extension (eg. Test Runner for Java on VScode)
- Open Test Explorer to shows all the test cases in the workspace
- To run tests select the green play button, on specific classes or entire workspace. You can also right-click on the play button to see more options. Demonstrated below