开发者

Java - @Before and @test annotation

开发者 https://www.devze.com 2023-04-05 08:19 出处:网络
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.

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

精彩评论

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