apache / netbeans

Apache NetBeans
https://netbeans.apache.org/
Apache License 2.0
2.68k stars 854 forks source link

Java with Ant - JUnit Bug #7819

Open antoniojvelezq opened 1 month ago

antoniojvelezq commented 1 month ago

Apache NetBeans version

Apache NetBeans 23

What happened

I created a simple unit test, but it generates the following error when running the test:

/home/ajvelez/.cache/netbeans/23/executor-snippets/junit.xml:184: The following error occurred while executing this line: /home/ajvelez/.cache/netbeans/23/executor-snippets/junit.xml:128: The or for must include junit.jar if not in Ant's own classpath

Language / Project Type / NetBeans Component

Java / Java with Ant / JUnit execute

How to reproduce

Create a Java with Ant y execute the next test

public class NewEmptyJUnitTest {

    public NewEmptyJUnitTest() {   }

     @Test
     public void hello() {
         assertEquals(20, 20);
     }
}

Did this work correctly in an earlier version?

No / Don't know

Operating System

Fedora 40

JDK

JDK17 and JDK22

Apache NetBeans packaging

Apache NetBeans provided installer

Anything else

No response

Are you willing to submit a pull request?

No

matthiasblaesing commented 1 month ago

Where is the reproducer for the problem?

antoniojvelezq commented 1 month ago

Create a Java with Ant project, and execute the next test.

public class NewEmptyJUnitTest {
public NewEmptyJUnitTest() {   }
 @Test public void hello() {
     assertEquals(20, 20);
 }
}
matthiasblaesing commented 1 month ago

@antoniojvelezq you could have simplified this by just providing the project. Anyway, yes, the projects seems to be incorrectly generated, as JUnit 5 is put onto the classpath.