This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
Context Menu Tools->JUnit Tests->Create Tests. Trying to create JUnit Tests on an existing class fails with "Class ... was skipped." if this class ist not public.
Reproduced on Linux, too. Accepted.
I think the core problem here is that JUnit checks class attributes even if just a single class is selected (and test class to be created for). If the class is package-private and package-private classes are skipped (see issue #52153 - "Do not skip package-private classes by default"), JUnit skips the only (selected) class, which is the bug that will be discussed here. The remaining problem is the confusing message which is to be solved separately (see bug #51972 - "No reasonable message when test generation is skipped").
Work around: Set the desired class temporarily to public (not possible, if you don't have the java source). Then create the JUnit Tests. Set the class back to package-private. Begin testing, and all works fine...
Fixed in the trunk. Modified files: junit/src/org/netbeans/modules/junit/: CreateTestAction.java (1.43) JUnitCfgOfCreate.java (1.32) junit/src/org/netbeans/modules/junit/wizards/: SimpleTestCaseWizardIterator.java (1.11)
Probably as a result of this fix, test creation now ignores the "Package Private Classes" checkbox and creates tests for package private classes always, even if the action is invoked on a whole package and the checkbox is unchecked.
Fixed. Checked in: junit/src/org/netbeans/modules/junit/TestCreator.java, rev 1.40
This is not reproducible both inside nb 5.0fcs and nb6.0 dev 200603141900. (FIXED && TM==4.1) => CLOSED