Bug 552537 - [JUnit 5] Cannot run tests inside secondary types
Summary: [JUnit 5] Cannot run tests inside secondary types
Status: CLOSED DUPLICATE of bug 529722
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.14   Edit
Hardware: PC Mac OS X
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-10-30 00:38 EDT by Sheng Chen CLA
Modified: 2019-10-30 05:38 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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 ***