Hi, I am going to test all the exceptions that can be thrown - provide some error input, if the exception thrown is what I expect, the JUnit test passes. And the project uses the Spring framework. I am not familiar with testing in the Spring framework; henceforth, I am writing to seek help.
Is it true that all I have to do is to write for the "numberFormatAsserter" class? How do I code it? Thank you.
where do I find the chapter that is dedicated to Testing?
I am supposed to write unit tests for all kinds of data errors that developers can think of. If the error is what expected, it should pass the unit test. I simply would like to start with an example; say, the NumberFormatException. My question is how do I code it?
I think that I was not specific enough. In the Spring framework shown in the earlier posts, how do I let the "null" output to pass the JUnit test? For example, I did something below. But, the JUnit test gives me the java.lang.AssertionError: Expected exception: java.lang.NullPointerException. But the NullPointerException is what I expected. I want to let it pass. In the Java class that is being tested, I have: