Bug 552537

Summary: [JUnit 5] Cannot run tests inside secondary types
Product: [Eclipse Project] JDT Reporter: Sheng Chen <sheche>
Component: UIAssignee: JDT-UI-Inbox <jdt-ui-inbox>
Status: CLOSED DUPLICATE QA Contact:
Severity: normal    
Priority: P3 CC: noopur_gupta
Version: 4.14   
Target Milestone: ---   
Hardware: PC   
OS: Mac OS X   
See Also: https://git.eclipse.org/r/151780
Whiteboard:

Description Sheng Chen CLA 2019-10-30 00:38:56 EDT
If a Java file is named as MyTest.java. And inside this compilation unit, there is a class with default package access modifier. The use cannot run the test through the context menu when right clicking the class name.

The root cause is that in JUnitLaunchConfigurationDelegate::getTestTarget(ILaunchConfiguration configuration, IJavaProject javaProject). It's using IJavaProject.findType(String fullyQualifiedName) to find the type, while this API can only find the types which match its corresponding compilation unit name.

Inorder to find the secondary types, we should use findType(String fullyQualifiedName, IProgressMonitor progressMonitor) instead.
Comment 1 Eclipse Genie CLA 2019-10-30 00:45:30 EDT
New Gerrit change created: https://git.eclipse.org/r/151780
Comment 2 Noopur Gupta CLA 2019-10-30 05:38:02 EDT

*** This bug has been marked as a duplicate of bug 529722 ***