Issue
In VS Code got a specific Java project with the following JUnit test
import static org.junit.Assert.fail;
import org.junit.Test;
class NgramTest {
@Test
public void test() {
fail("Not yet implemented");
}
}
If I run it, I get an initializationError saying
java.lang.Exception: Test class should have exactly one public constructor
What can be done to solve it?
Solution
You need to write public before class NgramTest. Change the code to
import static org.junit.Assert.fail;
import org.junit.Test;
public class NgramTest {
@Test
public void test() {
fail("Not yet implemented");
}
}
That way it'll work fine and you'll get, as expected, the result
java.lang.AssertionError: Not yet implemented
Answered By - Tiago Martins Peres