Details
-
Bug
-
Status: Open
-
Minor
-
Resolution: Unresolved
-
12.3
-
None
-
Windows 10, Apache NetBeans 12.3, Java 16
Description
Hello,
I created a simple class.
public class Example { public static void main(String[] args) { var color = new Example(); System.out.println(color.isTextBlack("black")); System.out.println(color.isTextBlack("white")); } public boolean isTextBlack(String color) { return color.equals("black"); } }
Then I create a JUnit 5 test via a "bulb" on the class line.
A file with this code will be generated.
import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.*; public class ExampleTest { public ExampleTest() { } @BeforeAll public static void setUpClass() { } @AfterAll public static void tearDownClass() { } @BeforeEach public void setUp() { } @AfterEach public void tearDown() { } /** * Test of main method, of class Example. */ @Test public void testMain() { System.out.println("main"); String[] args = null; Example.main(args); // TODO review the generated test code and remove the default call to fail. fail("The test case is a prototype."); } /** * Test of isTextBlack method, of class Example. */ @Test public void testIsTextBlack() { System.out.println("isTextBlack"); String color = ""; Example instance = new Example(); boolean expResult = false; boolean result = instance.isTextBlack(color); assertEquals(expResult, result); // TODO review the generated test code and remove the default call to fail. fail("The test case is a prototype."); } }
If I run it, it will crash with this error
warning: unknown enum constant Status.STABLE reason: class file for org.apiguardian.api.API$Status not found warning: unknown enum constant Status.STABLE warning: unknown enum constant Status.STABLE warning: unknown enum constant Status.STABLE warning: unknown enum constant Status.STABLE warning: unknown enum constant Status.STABLE warning: unknown enum constant Status.STABLE warning: unknown enum constant Status.STABLE warning: unknown enum constant Status.STABLE warning: unknown enum constant Status.STABLE warning: unknown enum constant Status.STABLE warning: unknown enum constant Status.STABLE warning: unknown enum constant Status.STABLE warning: unknown enum constant Status.STABLE warning: unknown enum constant Status.STABLE warning: unknown enum constant Status.STABLE warning: unknown enum constant Status.STABLE warning: unknown enum constant Status.STABLE warning: unknown enum constant Status.STABLE warning: unknown enum constant Status.STABLE warning: unknown enum constant Status.STABLE warning: unknown enum constant Status.STABLE warning: unknown enum constant Status.STABLE warning: unknown enum constant Status.STABLE warning: unknown enum constant Status.STABLE warning: unknown enum constant Status.STABLE warning: unknown enum constant Status.STABLE warning: unknown enum constant Status.STABLE warning: unknown enum constant Status.STABLE warning: unknown enum constant Status.STABLE warning: unknown enum constant Status.STABLE warning: unknown enum constant Status.STABLE warning: unknown enum constant Status.STABLE warning: unknown enum constant Status.STABLE warning: unknown enum constant Status.STABLE warning: unknown enum constant Status.STABLE warning: unknown enum constant Status.STABLE warning: unknown enum constant Status.STABLE warning: unknown enum constant Status.STABLE warning: unknown enum constant Status.STABLE warning: unknown enum constant Status.STABLE warning: unknown enum constant Status.STABLE warning: unknown enum constant Status.STABLE warning: unknown enum constant Status.STABLE warning: unknown enum constant Status.STABLE warning: unknown enum constant Status.STABLE warning: unknown enum constant Status.STABLE warning: unknown enum constant Status.STABLE warning: unknown enum constant Status.STABLE warning: unknown enum constant Status.STABLE warning: unknown enum constant Status.STABLE warning: unknown enum constant Status.STABLE warning: unknown enum constant Status.STABLE warning: unknown enum constant Status.STABLE warning: unknown enum constant Status.STABLE warning: unknown enum constant Status.STABLE warning: unknown enum constant Status.STABLE warning: unknown enum constant Status.STABLE warning: unknown enum constant Status.STABLE warning: unknown enum constant Status.STABLE warning: unknown enum constant Status.STABLE warning: unknown enum constant Status.STABLE warning: unknown enum constant Status.STABLE warning: unknown enum constant Status.STABLE warning: unknown enum constant Status.STABLE warning: unknown enum constant Status.STABLE warning: unknown enum constant Status.STABLE warning: unknown enum constant Status.STABLE warning: unknown enum constant Status.STABLE warning: unknown enum constant Status.STABLE warning: unknown enum constant Status.STABLE warning: unknown enum constant Status.STABLE warning: unknown enum constant Status.STABLE warning: unknown enum constant Status.STABLE warning: unknown enum constant Status.STABLE warning: unknown enum constant Status.STABLE warning: unknown enum constant Status.STABLE warning: unknown enum constant Status.STABLE warning: unknown enum constant Status.STABLE warning: unknown enum constant Status.STABLE warning: unknown enum constant Status.STABLE warning: unknown enum constant Status.STABLE warning: unknown enum constant Status.STABLE warning: unknown enum constant Status.STABLE warning: unknown enum constant Status.STABLE warning: unknown enum constant Status.STABLE warning: unknown enum constant Status.STABLE warning: unknown enum constant Status.STABLE warning: unknown enum constant Status.STABLE warning: unknown enum constant Status.STABLE warning: unknown enum constant Status.STABLE warning: unknown enum constant Status.STABLE warning: unknown enum constant Status.STABLE warning: unknown enum constant Status.STABLE warning: unknown enum constant Status.STABLE warning: unknown enum constant Status.STABLE warning: unknown enum constant Status.STABLE warning: unknown enum constant Status.STABLE warning: unknown enum constant Status.STABLE warning: unknown enum constant Status.STABLE 100 warnings only showing the first 100 warnings, of 124 total; use -Xmaxwarns if you would like to see more
If I delete the file and create Junit 4 (see the picture above), the same code will be generated, only with the import of other libraries.
import org.junit.After; import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; import static org.junit.Assert.*;
JUnit 4 works without any problems. The mystery is that if I now delete the file and create JUnit 5, JUnit4 will be created again.
Anyway, JUnit5 is unusable.
Please repair.
Thank you