unit testing - Java JUnit test case with exceptions -


what's wrong this. have junit 4enter image description here

you can declare on @test annotation that, test pass, must throw these exceptions:

@test(expected = nullpointerexception.class) public void testsynapseone() {     // test }   @test(expected = illegalstateexception.class) public void testsynapsetwo() {     // test } 

of course, have sure you're testing right thing - currently, tests don't make use of constructor, critical piece want test.

oh - don't want have tests extend testcase unless need compatibility junit3.x.


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -