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.

Bug 165914 - Cannot generate test for a package private class
Summary: Cannot generate test for a package private class
Status: RESOLVED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: JUnit (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker (vote)
Assignee: Andrey Yamkovoy
URL:
Keywords:
Depends on:
Blocks: 170621
  Show dependency tree
 
Reported: 2009-05-25 07:36 UTC by Jan Lahoda
Modified: 2010-04-15 12:32 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Lahoda 2009-05-25 07:36:24 UTC
1. create a J2SE application project with a main class
2. make the class package private
3. try to create a junit test for it (Tools/Create JUnit Test, choose JUnit 4, confirm the next dialog without changes).
4. two dialogs appear:
Class [...] was skipped because it was package private.
No tests were created because no testable class was found.
5. the test class is not created.

Not sure why package private class is considered untestable - the test class is to be created in the same package, so
the original class is accessible from the test. The test generator should not prevent the user from creating a test for
a package private class. A workaround is to make the class public temporarily.

Product Version: NetBeans IDE Dev (Build jet-main-678-on-090520)
Java: 1.6.0_10-rc; Java HotSpot(TM) Client VM 11.0-b15
System: Linux version 2.6.21.4-eeepc running on i386; UTF-8; en_US (nb)
Userdir: /media/karta/space/userdir
Comment 1 Andrey Yamkovoy 2009-05-25 08:35:01 UTC
Already fixed.
See changeset http://hg.netbeans.org/main/rev/1c5ab8f7d046
Comment 2 Victor Vasilyev 2010-04-15 12:01:42 UTC
If the method
org.netbeans.modules.junit.TestabilityResult.filter(TestabilityResult, long) 
will be fixed according to the Bug 170621 then this bug need to be fixed again, but another way should be used.
Comment 3 Victor Vasilyev 2010-04-15 12:32:39 UTC
Fixed
http://hg.netbeans.org/main/rev/6ed2919e6def

See also bug 170621