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

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -