annotations - How to set an expected exception using Scala and JUnit 4 -
I want to set an expected exception for a JUnit 4 test using Scala. I am doing something similar to the following:
@Test (expected = classoff [nullPointException]) def some Test () = {// some test code}
< P> But I get the following compiler error: Error: Wrong number of arguments for constructor test: () org.junit.Test
The way the attributes are related to attributes, it is a little cowardly; I think what you are trying to do, this Should be expressed as:
@Test {val expected = classOf [NullPointerException]} def someTest {// test code}
Comments
Post a Comment