Uploaded image for project: 'NetBeans'
  1. NetBeans
  2. NETBEANS-1661

Can't use "Run focused test method" context menu

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Works for Me
    • 9.0, 10.0
    • 11.3
    • java - JUnit
    • Windows 7,10

    Description

      When editing a Junit test in the editor, the contextual menu offers 4 ways of testing. Debug File and Test File work fine, but Run Focused Test Method and Debug Focused Test method throw exceptions:

      When clicking Run Focused Test Method:

      java.lang.IllegalArgumentException: run.single.method
          at org.netbeans.modules.java.api.common.project.BaseActionProvider.getTargetNames(BaseActionProvider.java:333)
          at org.netbeans.modules.web.project.WebActionProvider.getTargetNames(WebActionProvider.java:423)
          at org.netbeans.modules.java.api.common.project.BaseActionProvider$2.getTargetNames(BaseActionProvider.java:253)
          at org.netbeans.modules.java.api.common.project.ActionProviderSupport$JavaModelWork.execute(ActionProviderSupport.java:1303)
          at org.netbeans.modules.java.api.common.project.ActionProviderSupport$JavaModelWork.run(ActionProviderSupport.java:1285)
          at org.netbeans.modules.java.api.common.project.ActionProviderSupport.invokeTarget(ActionProviderSupport.java:217)
          at org.netbeans.modules.java.api.common.project.BaseActionProvider.invokeAction(BaseActionProvider.java:242)
          at org.netbeans.spi.project.support.LookupProviderSupport$MergedActionProvider.invokeAction(LookupProviderSupport.java:262)
          at org.netbeans.modules.gsf.testrunner.ui.api.TestMethodRunnerProvider$3$1.run(TestMethodRunnerProvider.java:134)
          at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
          at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
          at java.awt.EventQueue.access$500(EventQueue.java:97)
          at java.awt.EventQueue$3.run(EventQueue.java:709)
          at java.awt.EventQueue$3.run(EventQueue.java:703)
          at java.security.AccessController.doPrivileged(Native Method)
          at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
          at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
          at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:136)
      [catch] at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205)
          at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
          at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
          at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
          at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
          at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)

       

      When clicking Debug Focused Test Method:

      java.lang.IllegalArgumentException: debug.single.method
          at org.netbeans.modules.java.api.common.project.BaseActionProvider.getTargetNames(BaseActionProvider.java:333)
          at org.netbeans.modules.web.project.WebActionProvider.getTargetNames(WebActionProvider.java:423)
          at org.netbeans.modules.java.api.common.project.BaseActionProvider$2.getTargetNames(BaseActionProvider.java:253)
          at org.netbeans.modules.java.api.common.project.ActionProviderSupport$JavaModelWork.execute(ActionProviderSupport.java:1303)
          at org.netbeans.modules.java.api.common.project.ActionProviderSupport$JavaModelWork.run(ActionProviderSupport.java:1285)
          at org.netbeans.modules.java.api.common.project.ActionProviderSupport.invokeTarget(ActionProviderSupport.java:217)
          at org.netbeans.modules.java.api.common.project.BaseActionProvider.invokeAction(BaseActionProvider.java:242)
          at org.netbeans.spi.project.support.LookupProviderSupport$MergedActionProvider.invokeAction(LookupProviderSupport.java:262)
          at org.netbeans.modules.gsf.testrunner.ui.api.TestMethodDebuggerProvider$3$1.run(TestMethodDebuggerProvider.java:128)
          at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
          at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
          at java.awt.EventQueue.access$500(EventQueue.java:97)
          at java.awt.EventQueue$3.run(EventQueue.java:709)
          at java.awt.EventQueue$3.run(EventQueue.java:703)
          at java.security.AccessController.doPrivileged(Native Method)
          at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
          at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
          at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:136)
      [catch] at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205)
          at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
          at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
          at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
          at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
          at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)

       

      Problems seems to only happen in netbeans 9 and 10. In 8.2 it works fine. 

      tested on JDK 8 and 11, no difference.

      Also the problem only seems to happen in Java Web Aplications project (Had to install the Java EE Base module trough 8.2 plugin distribution portal), in a vanilla Java project it works fine.

      To reproduce just create a or open an existing Java Web Aplication, create a class, create a test and try the contextual menu.

       

       

      Attachments

        Activity

          People

            Unassigned Unassigned
            jalgaba Juan Roberto
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: