How do you write an expected exception in JUnit?
In JUnit, we have 3 types of testing the needed exceptions : @Test, optional ‘expected’ attribute @Rule ExpectedException Try-catch and always fail()
Do you want to know if you have to choose JUnit 5 or TestNG? Here you go: https://www.softwaretestinghelp.com/junit-vs-testng/