diff --git a/java-extension/com.microsoft.java.test.plugin/src/main/java/com/microsoft/java/test/plugin/util/ProjectTestUtils.java b/java-extension/com.microsoft.java.test.plugin/src/main/java/com/microsoft/java/test/plugin/util/ProjectTestUtils.java index ccf9d076..d1279592 100644 --- a/java-extension/com.microsoft.java.test.plugin/src/main/java/com/microsoft/java/test/plugin/util/ProjectTestUtils.java +++ b/java-extension/com.microsoft.java.test.plugin/src/main/java/com/microsoft/java/test/plugin/util/ProjectTestUtils.java @@ -76,7 +76,7 @@ public static Set parseProjects(String uriStr) { return Collections.emptySet(); } return Arrays.stream(ProjectUtils.getJavaProjects()) - .filter(p -> belongToProject(parentPath, p.getProject())) + .filter(p -> isProjectBelongToPath(p.getProject(), parentPath)) .collect(Collectors.toSet()); } @@ -135,7 +135,23 @@ public static boolean isTest(IClasspathEntry entry) { return entry.isTest(); } - public static boolean belongToProject(IPath testPath, IProject project) { + public static boolean isProjectBelongToPath(IProject project, IPath path) { + // Check for visible project + if (project.getLocation() != null && path.isPrefixOf(project.getLocation())) { + return true; + } + + + // Check for invisible project + final IPath linkedLocation = project.getFolder(WORKSPACE_LINK).getLocation(); + if (linkedLocation != null && path.isPrefixOf(linkedLocation)) { + return true; + } + + return false; + } + + public static boolean isPathBelongToProject(IPath testPath, IProject project) { // Check if the path belongs to visible project if (project.getLocation() != null && project.getLocation().isPrefixOf(testPath)) { return true; diff --git a/java-extension/com.microsoft.java.test.plugin/src/main/java/com/microsoft/java/test/plugin/util/RuntimeClassPathUtils.java b/java-extension/com.microsoft.java.test.plugin/src/main/java/com/microsoft/java/test/plugin/util/RuntimeClassPathUtils.java index 1e647dae..af300cc1 100644 --- a/java-extension/com.microsoft.java.test.plugin/src/main/java/com/microsoft/java/test/plugin/util/RuntimeClassPathUtils.java +++ b/java-extension/com.microsoft.java.test.plugin/src/main/java/com/microsoft/java/test/plugin/util/RuntimeClassPathUtils.java @@ -49,7 +49,7 @@ public static String[] resolveRuntimeClassPath(List arguments) throws Co while (iterator.hasNext()) { final IJavaProject javaProject = iterator.next(); final IProject project = javaProject.getProject(); - if (ProjectTestUtils.belongToProject(testPath, project)) { + if (ProjectTestUtils.isPathBelongToProject(testPath, project)) { projectsToTest.add(javaProject); iterator.remove(); }