I know this question is pretty general but I haven\'t found any hints on why this error may show up. What are possible causes of seeing initalizationError in Eclips
This problem also occurs if you have a private Rule in you class:
@Rule
private TemporaryFolder folderRule;
Make it public.
In my case, I had the following import in my test case:
import org.junit.jupiter.api.Test;
The correct import is:
import org.junit.Test;
Don't just import any old Test type from junit, make sure you pick the correct one.
For me the solution was one of the methods had to be void, I had it as Boolean.
You've probably got one of two problems:
1) You're using JUnit 4.11, which doesn't include hamcrest. Add the hamcrest 1.3 library to your classpath.
2) You've got hamcrest 1.3 on your classpath, but you've got another version of either junit or hamcrest on your classpath.
For background, junit pre 4.11 included a cut down version of hamcrest 1.1. 4.11 removed these classes.
For me it was a missing static
keyword in one of the JUnit annotated methods, e.g.:
@AfterClass
public static void cleanUp() {
// ...
}
I've experimented the exact same error. My problem was that the SetUp method I had created was declared as static.
If using eclipse, one could get a good description by clicking above the error and then checking the Failure trace window, just below... That's how I found the real problem!