3
Contributors
2
Replies
3
Views
5 Years
Discussion Span
Last Post by JamesCherrill
0

I'm not sure what you really want? Please give us some cases/examples that you want to test.

Sometimes, you could use try/catch in the test. When certain values should not be there but it all the sudden gets to there, you could throw an exception. Then catch the exception in your catch clause to confirm that it correctly throws the exception.

0

I'm no JUnit expert, but AFAIK it runs tests at the method level and doesn't have any facilities for testing individual loops etc inside a method. In other words, it treats the method being tested as a "black box" - it supplies data, runs the method, and checks that the results are correct. If all the results are correct then you generally assume that the code inside the method must be correct.
Maybe a JUnit expert here can add to that???

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.