开发者

Java - @Before and @test annotation

I am very new to Java programming. I have a unit test file to be run. It has annotations of @Before and @Test. I have tried to understand these concepts using available online resources.

When I am debugging my UnitTest.java file, only the @Before part gets executed. It does not reach @Test and the program fails saying:

NativeMethodAccessorImpl.Object(开发者_Python百科....) not available.

This does not happen when I run the unit tests (as opposed to debugging the unit tests). How do I go about solving this?


The @Before and @Test annotations are used to define unit tests for the Java JUnit testing framework. See http://junit.sourceforge.net/doc/cookbook/cookbook.htm for an introduction and examples of JUnit unit testing using these annotations.

Your problem is that your have mis-spelled the @Test annotation as @test.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜