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 249765 - Patch for: "Go To Test" does not detect tests with different naming scheme
Summary: Patch for: "Go To Test" does not detect tests with different naming scheme
Status: NEW
Alias: None
Product: java
Classification: Unclassified
Component: JUnit (show other bugs)
Version: 8.0.2
Hardware: PC Windows 7
: P3 normal with 1 vote (vote)
Assignee: Theofanis Oikonomou
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-01-12 23:08 UTC by markiewb
Modified: 2016-01-10 19:41 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Patch which determines also the other file schemes (3.53 KB, patch)
2015-01-13 00:06 UTC, markiewb
Details | Diff
Patch v2 (3.31 KB, patch)
2015-01-13 20:31 UTC, markiewb
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description markiewb 2015-01-12 23:08:19 UTC
"Go To Test" does not detect tests with different naming schemes. 

This is common in legacy projects coming from Eclipse. Eclipse has/had no difference between source and test-sources, so often a different packagename is/was used to distinguish files (and filter them out later).

Example A:
----------
Source file: com/foo/MyClass.java
Test file: com/foo/impl/MyClassTest.java (<-- this file is not detected as the opposite file)

Example B:
----------
Source file: com/foo/MyClass.java

All the following test files are candidates to be the opposite files. Multiple results are possible.


com/foo/MyClassTest.java 
com/foo/MyClassIT.java
com/foo/impl/MyClassTest.java
com/foo/impl/MyClassAnotherTest.java
com/foo/MyClassExpensiveTest.java
com/foo/MyClassInexpensiveTest.java

Product Version: NetBeans IDE 8.0.2 (Build 201411181905)
Java: 1.8.0_05; Java HotSpot(TM) 64-Bit Server VM 25.5-b02
Runtime: Java(TM) SE Runtime Environment 1.8.0_05-b13
System: Windows 7 version 6.1 running on amd64; Cp1252; en_US (nb)
Comment 1 markiewb 2015-01-13 00:06:02 UTC
Created attachment 151471 [details]
Patch which determines also the other file schemes

Please have a look at the patch. It searches for the other file name patterns using the ClassIndex, which are printed to stdout.

There can be multiple results, but the gototest-api does not support multiple target locations. So I could not finish this patch.
Comment 2 markiewb 2015-01-13 20:31:09 UTC
Created attachment 151490 [details]
Patch v2

Another simplified version of the patch. This time SourceUtils.getFile() is used to resolve the file for the ElementHandle.
Comment 3 Theofanis Oikonomou 2015-03-20 12:48:32 UTC
Thank you for the patch. Changing the gototest's TestLocator interface would require a api review and also changes to the friend modules already implementing the spi. Having said that I am removing the keyword as the patch IMHO just scratches the surface of what needs to be done to fix this issue. Would you be interested in contributing to an effort to start the api review?

Thank you again for your time.
Comment 4 markiewb 2015-03-20 17:48:58 UTC
(In reply to Theofanis Oikonomou from comment #3)
> Would you be interested in contributing to an effort to start the api
> review?

If you guide me, how to do it, then of course yes!
Comment 5 Theofanis Oikonomou 2015-09-04 12:28:08 UTC
(In reply to markiewb from comment #4)
> (In reply to Theofanis Oikonomou from comment #3)
> > Would you be interested in contributing to an effort to start the api
> > review?
> 
> If you guide me, how to do it, then of course yes!

This is not doable for 8.1 time schedule. Hopefully there will be time to do this for next release.