Hello,
I recently upgraded from NetBeans 6.7.1 to NetBeans 6.9 and my old JUnit tests are showing "cannot find symbol" errors in the NetBeans editor around the import statements.
Everything builds correctly on these unit tests and I can still run/debug the unit tests without any issues. However, auto-complete within the editor doesn't work at all for the classes it can't find. This is making it difficult to create new JUnit tests.
I can import classes from another module within the suite correctly. Java API classes also import without issue. This seems like a dependency issue, but I don't know how to fix it.
Here's the hypothetical NetBeans project structure I'm running on:
MyCodeSuite
- MyNetBeansModule1
- - Source Packages
- - - com.company.module1.foo
- - - - DoSomething1
- - - - DoSomethingElse1
- - - - ClassInQuestion
- - Unit Test Packages
- - - com.company.module1.foo
- - - - ClassInQuestionTest
- MyNetBeansModule2
- - Source Packages
- - - com.company.module2.foo
- - - - DoSomething2
- - - - DoSomethingElse2
ClassInQuestionTest.java:
package com.company.module1.foo;
import com.company.module1.foo.DoSomething1; // this is where the editor starts showing errors; these errors are propagated throughout the code anywhere "DoSomething1" shows up
import com.company.module2.foo.DoSomething2; // the editor doesn't complain for this one
// These imports all work correctly
import java.util.List;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.*;
I've duplicated this for new unit tests as well as existing unit tests. It doesn't matter what class I'm importing from thecom.company.module1.foo
package. The editor shows errors for any class within that package and within that same module.
Also, note that I'm using the "Create JUnit Tests" context menu item within NetBeans 6.9 to get going on new unit tests. This is also how the original unit tests classes (under NB 6.7.1) were created.