samedi 1 juin 2019

JUnit 5: assertThrows checking for one exception, passing just one test case

I'm using JUnit 5 and the assertThrows() method to check for a InputMismatchException, but the test passes just for one of the many cases, even if all of them throw InputMismatchException successfully.

All the failed cases show the following exception:

java.util.InputMismatchException: Error.

Error. is the error message I set for the exception.

Since each and every test case should throw InputMismatchException and pass the test, why only one of them is actually passing?

Aucun commentaire:

Enregistrer un commentaire