I am trying to write a unit test for a method which takes a string as a para- meter and throws an exception if it is malformed (AND NONE if it is okay). I want to write a parameterized test which feeds in several strings and the expected exception (INCLUDING the case that none is thrown if the input string is well-formed!). If trying to use the @Test(expect=SomeException.class) annotation, I encountered two problems:
expect=null is not allowed. So how could I test for the expected outcome of NO exception to be thrown (for well-formed input strings)?
expect= not possible? I not yet tried it, but I strongly suspect that this is the case after reading this (could you please state whether this is true?): http://tech.groups.yahoo.com/group/junit/message/19383 This then seems to be the best solution I found yet. What do you think about it, especially compared to that: How do I test exceptions in a parameterized test?
Thank you in advance for any help, I look forward the discussion :)