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.
|Summary:||Groovy editor not using maven test scoped dependencies for hints; at least the for the test annotations|
|Product:||groovy||Reporter:||_ wadechandler <wadechandler>|
|Component:||Editor||Assignee:||Martin Janicek <mjanicek>|
|Issue Type:||DEFECT||Exception Reporter:|
|Attachments:||Project showing the hint issue|
Description _ wadechandler 2013-03-22 12:23:05 UTC
It is very simple to reproduce. Create a regular Java application maven project in NetBeans; call it groovy-test-scope; give it a package name "org.netbeans.groovy.testscope". Create a folder under the project called src/test/groovy (standard Groovy placement for Maven groovy maven unit tests per the groovy plugin), add a JUnit dep to your pom.xml and scope it test (remove the 3.8.1 which is added when the project is created): <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.11</version> <scope>test</scope> </dependency> In src/test/groovy, create a new folder and call it org/netbeans/groovy/testscope. Create a new Groovy class and call it GroovyEditorTestScopeUTest (or whatever you like). Add a method called groovyEditorScopeTest(), and annotated it @Test. The hint won't show up initially either if you just type @Test before creating the method body. Create the full method body annotated with @Test (seems there are 2 issues here really). Once you have annotated the fully method body, you see the hint popup. It states "junit.framework.Test" which is incorrect were it using the right deps it would be "org.junit.Test".
Comment 1 _ wadechandler 2013-03-22 12:24:28 UTC
I have a project I am going to attach which demos this issue. Initially the build will fail because the import statements are not yet included in the GroovyEditorTestScopeUTest.groovy file, so if you add the right imports it will build, but before you do that, you can see the hint which is given.
Comment 2 _ wadechandler 2013-03-22 12:26:18 UTC
Created attachment 132945 [details] Project showing the hint issue
Comment 3 _ wadechandler 2013-03-22 12:28:42 UTC
So, if you grab the attachment I just put up, then you can open up the test file and see the issue. Now, I'm not sure yet if this only applies to the JUnit hint or not, or if it is something more pervasive where the groovy editor isn't using the test scope correctly in various places, but this is a specific example.
Comment 4 _ wadechandler 2013-03-22 12:29:49 UTC
I could see this being called a feature perhaps too, but the Java editor does it, so in reality it feels like a bug. Too, I bet if we click that hint, it will probably add a dependency other than the one we are using.
Comment 5 _ wadechandler 2013-03-22 12:30:27 UTC
When I say the Java editor does it...I mean it acts as expected. Gives the correct package name from our dep list.
Comment 6 Martin Janicek 2013-03-22 14:12:16 UTC
Thanks Wade. I remember I've been fixing something similar few months ago.. It's definitelly a defect, hint doesn't work correctly. Although the logic is almost certainly used only for the hint + maybe fix imports action, so it should not affect any other functionality. Decreasing priority to P3 issue as the workarround is pretty simple. Anyway, I agree this need to work.. I'll take a look at it during the next week..