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 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. Using the Netbeans...Tools..Create/Update Tests on the project for the class creating placeholder tests to provide a wealth of test coverage. This method tends to generate a lot of test coverage (most with "fails" initially to force review and updates of each test to make sure it's written for the true need of the unit test case.) 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. 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. > 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). Also, when trying to build, see if there are any clues in the Output pane that may help provide some additional guidance. Eric Bresie ebre...@gmail.com