On Sun, Jan 8, 2023 at 7:25 AM Eric Bresie <ebre...@gmail.com> wrote:
> > > > On Sat, Jan 7, 2023 at 9:07 PM Will Hartung <willhart...@gmail.com> wrote: > >> I have maven javafx project. Java 17, NB 15. It's also a modular >> application with a module-info. >> > > Might want to consider updating to NB 16...I believe some of the > functionality around some of this has improved a little bit. > I tried 16, and there was no change. I also tried simply closing the project and reloading it. > > >> I try to create a test for a class, and all I get is an empty class. It >> has the JUnit imports, but no test methods. Just an empty class with an >> empty constructor. None of the methods.\ >> > > Did you use File..."New Unit Test"? In this case then each test has to > be manually added as desired. > I was using the "Create Unit Test for Class" facility. > > Also, I can't seem to add any of my classes to the generated class. Auto >> complete doesn't see any of the classes, and when I compile the test, it >> also complains it can not find the classes. >> > > Have you tried any of the "hints" / "fixes" on the left gutter? > This often times when hovered over will help with some basic fixes. > It simply says cannot find symbol. > > Maven projects tend to have additional "dependencies" listed in the > Project explorer. Dependencies can be added in this context or can be > manually added in the pom.xml files > > Be mindful it's important to have a good build of the dependency classes; > if there is some kind of problem compiling one of them (i.e. say a missing > dependency), then usage of that generated class may not work until such > time as it's been successfully built and available for use elsewhere. > The project (without the test) builds fine, the class I want the test for is within the project. > > >> Yet, I created a simple JavaFX project, added a test to that, and it >> worked fine. >> >> I took my pom.xml from my project, and replaced the one from the simple >> project with it, and everything worked fine. >> >> So, I don't know what else I could check to see why the testing does not >> work for my project, but works for another with an identical pom file >> (barring the project name). >> > > Is the new project also a Maven project or was it originally an "Ant" > project? Netbeans treats these slightly differently and the project > explorer shows different things (i.e. in "ant projects" right clicking > allows configuring "Properties...Libraries''; with "maven projects" project > shows "Dependencies [including a "Test Dependencies]" to be leverage (right > clicking on the "Dependencies" here allows "Add Dependencies" which > reflects it here and will modify the pom.xml file at the same time). > It's a Maven project. > > Also, when trying to build, see if there are any clues in the Output pane > that may help provide some additional guidance. > Is just a simple syntax error: COMPILATION ERROR : ------------------------------------------------------------- pkg/MyTest.java:[17,24] cannot find symbol symbol: class MyProjectClass location: package pkg 1 error ------------------------------------------------------------- Eric Bresie > ebre...@gmail.com > Thank Eric! Regards, WIll Hartung