I would like to display a warning in a JUnit test. I don’t want the test to fail because of that warning but I would like to know that the warning occurs. Obviously, I can use System.err.print or something similar. Now I wonder what is the right way to do it
I would like to display a warning in a JUnit test. I don’t want
Share
I have also thought that this would useful at times, but this can’t be done. JUnit insists on a right and wrong answer and so only has “success”, “fail”, and “error”. Error being when something breaks in the code while running the test. I would refactor and consider if you really need a warning (or log like the previous answer suggests, although I think this warning would soon get lost),