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 48477 - CreateTestAction throws exception when test/unit/src directory not present
Summary: CreateTestAction throws exception when test/unit/src directory not present
Status: CLOSED FIXED
Alias: None
Product: apisupport
Classification: Unclassified
Component: Project (show other bugs)
Version: 4.x
Hardware: All All
: P3 blocker (vote)
Assignee: Tomas Zezula
URL:
Keywords:
Depends on:
Blocks: 42682
  Show dependency tree
 
Reported: 2004-09-03 22:34 UTC by _ tball
Modified: 2006-03-24 09:54 UTC (History)
1 user (show)

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 _ tball 2004-09-03 22:34:22 UTC
I tried running the CreateTestAction on a module
that didn't have a test directory (classfile). 
The following exception was thrown:

java.lang.IllegalArgumentException: URL must be a
folder URL (append '/' if necessary):
file:/work/src/netbeans/nb_all/classfile/test/unit/src
	at
org.netbeans.spi.java.classpath.support.ClassPathSupport.createResource(ClassPathSupport.java:56)
	at
org.netbeans.modules.junit.CreateTestAction.performAction(CreateTestAction.java:186)

After creating the test/unit/src directory outside
of the IDE, the action worked correctly.
Comment 1 Ondrej Rypacek 2004-09-06 09:30:47 UTC
confirmed
Comment 2 Ondrej Rypacek 2004-09-07 13:50:57 UTC
This is for projects. The code in JUnit does (essentially) just:

   ...
   URL testRoot = UnitTestForSourceQuery.findUnitTest(packageRoot);     
   ClassPathSupport.createResource(testRoot)   <-- throws the exception
   ...

testRoot is something like "/home/or141057/tmp/App1/test", which
directory doesn't exist.

Comment 3 David Konecny 2004-09-07 17:13:39 UTC
Tomas, you were fixing this recently in some other place. Could you
fix this too? Or assign to me if you do not have a time.
Comment 4 Tomas Zezula 2004-09-07 17:23:02 UTC
OK.
Comment 5 Jesse Glick 2004-09-07 17:42:14 UTC
This is an NBM project, not a j2seproject.

If there is no test dir, the test query should return null.
Comment 6 Tomas Zezula 2004-09-09 10:55:39 UTC
Checking in
project/src/org/netbeans/modules/apisupport/project/UnitTestForSourceQueryImpl.java;
/cvs/apisupport/project/src/org/netbeans/modules/apisupport/project/UnitTestForSourceQueryImpl.java,v
 <--  UnitTestForSourceQueryImpl.java
new revision: 1.6; previous revision: 1.5
done
Processing log script arguments...
More commits to come...
RCS file:
/cvs/apisupport/project/test/unit/src/org/netbeans/modules/apisupport/project/UnitTestForSourceQueryImplTest.java,v
done
Checking in
project/test/unit/src/org/netbeans/modules/apisupport/project/UnitTestForSourceQueryImplTest.java;
/cvs/apisupport/project/test/unit/src/org/netbeans/modules/apisupport/project/UnitTestForSourceQueryImplTest.java,v
 <--  UnitTestForSourceQueryImplTest.java
initial revision: 1.1
Comment 7 Marian Mirilovic 2005-12-20 15:48:50 UTC
This issue was solved long time ago. Because nobody has reopened it neither
added comments, we are verifying/closing it now. 
If you are still able to reproduce the problem, please reopen. Thanks in advance.