I normally don't experience problem with JUnit annotation. But somehow today, with my new install of Netbeans 7.2, I am experiencing the following error when I use the @Before
annotation:
annotation before is missing value for the attribute value
Does anyone know how to fix this?
UPDATE
I am writing a mavenized web-app.
For the TestCase, when I try to import org.junit.Before
the program instead imports org.aspectj.lang.annotation.Before
We can also explicitly specify the attributes in a @Test annotation. Test attributes are the test specific, and they are specified at the right next to the @Test annotation.
@Value is a Java annotation that is used at the field or method/constructor parameter level and it indicates a default value for the affected argument. It is commonly used for injecting values into configuration variables - which we will show and explain in the next part of the article.
Are you still getting the same error even after adding junit dependency in pom.xml
?
Check to see that you are importing the right library i.e.
import org.junit.Before;
instead of
import org.aspectj.lang.annotation.Before;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With