File tree Expand file tree Collapse file tree 5 files changed +36
-20
lines changed
junit-platform-commons/src/testFixtures/java/org/junit/platform/commons/test
src/test/java/org/junit/vintage/engine
jupiter-tests/src/test/java/org/junit/jupiter/engine/extension
platform-tests/src/test/java/org/junit/platform/launcher/core Expand file tree Collapse file tree 5 files changed +36
-20
lines changed Original file line number Diff line number Diff line change 1+ /*
2+ * Copyright 2015-2025 the original author or authors.
3+ *
4+ * All rights reserved. This program and the accompanying materials are
5+ * made available under the terms of the Eclipse Public License v2.0 which
6+ * accompanies this distribution and is available at
7+ *
8+ * https://www.eclipse.org/legal/epl-v20.html
9+ */
10+
11+ package org .junit .platform .commons .test ;
12+
13+ /**
14+ * Collection of test utilities for IDEs.
15+ */
16+ public class IdeUtils {
17+
18+ /**
19+ * Determine if the current code is running in the Eclipse IDE.
20+ * <p>Copied from {@code org.springframework.core.testfixture.ide.IdeUtils}.
21+ */
22+ public static boolean runningInEclipse () {
23+ return StackWalker .getInstance ().walk (
24+ stream -> stream .anyMatch (stackFrame -> stackFrame .getClassName ().startsWith ("org.eclipse.jdt" )));
25+ }
26+
27+ }
Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ dependencies {
2424 testImplementation(projects.junitPlatformLauncher)
2525 testImplementation(projects.junitPlatformSuiteEngine)
2626 testImplementation(projects.junitPlatformTestkit)
27+ testImplementation(testFixtures(projects.junitPlatformCommons))
2728 testImplementation(testFixtures(projects.junitJupiterApi))
2829 testImplementation(testFixtures(projects.junitPlatformLauncher))
2930 testImplementation(testFixtures(projects.junitPlatformReporting))
Original file line number Diff line number Diff line change @@ -865,7 +865,7 @@ void executesJUnit4TestCaseWithRunnerWithDuplicateChangingChildDescriptions() {
865865 }
866866
867867 @ Test
868- @ DisabledIf ("runningInEclipse" )
868+ @ DisabledIf ("org.junit.platform.commons.test.IdeUtils# runningInEclipse() " )
869869 void executesUnrolledSpockFeatureMethod () {
870870 // Load Groovy class via reflection to avoid compilation errors in Eclipse IDE.
871871 String testClassName = "org.junit.vintage.engine.samples.spock.SpockTestCaseWithUnrolledAndRegularFeatureMethods" ;
@@ -888,7 +888,7 @@ void executesUnrolledSpockFeatureMethod() {
888888 }
889889
890890 @ Test
891- @ DisabledIf ("runningInEclipse" )
891+ @ DisabledIf ("org.junit.platform.commons.test.IdeUtils# runningInEclipse() " )
892892 void executesRegularSpockFeatureMethod () {
893893 // Load Groovy class via reflection to avoid compilation errors in Eclipse IDE.
894894 String testClassName = "org.junit.vintage.engine.samples.spock.SpockTestCaseWithUnrolledAndRegularFeatureMethods" ;
@@ -957,12 +957,4 @@ private static boolean atLeastJUnit4_13() {
957957 return JUnit4VersionCheck .parseVersion (Version .id ()).compareTo (new BigDecimal ("4.13" )) >= 0 ;
958958 }
959959
960- /**
961- * Determine if the current code is running in the Eclipse IDE.
962- */
963- static boolean runningInEclipse () {
964- return StackWalker .getInstance ().walk (
965- stream -> stream .anyMatch (stackFrame -> stackFrame .getClassName ().startsWith ("org.eclipse.jdt" )));
966- }
967-
968960}
Original file line number Diff line number Diff line change 3535// Mockito cannot mock this class: class org.junit.jupiter.engine.execution.NamespaceAwareStore.
3636// You are seeing this disclaimer because Mockito is configured to create inlined mocks.
3737// Byte Buddy could not instrument all classes within the mock's type hierarchy.
38- @ DisabledIf (value = "runningInEclipse" , disabledReason = "Mockito cannot create a spy for NamespaceAwareStore using the inline MockMaker in Eclipse IDE" )
38+ @ DisabledIf (//
39+ value = "org.junit.platform.commons.test.IdeUtils#runningInEclipse()" , //
40+ disabledReason = "Mockito cannot create a spy for NamespaceAwareStore using the inline MockMaker in Eclipse IDE" )
3941@ DisplayName ("TimeoutInvocationFactory" )
4042@ ExtendWith (MockitoExtension .class )
4143class TimeoutInvocationFactoryTests {
@@ -100,13 +102,4 @@ void shouldCreateTimeoutInvocationForSeparateThreadTimeoutThreadMode() {
100102 assertThat (invocation ).isInstanceOf (SeparateThreadTimeoutInvocation .class );
101103 }
102104
103- /**
104- * Determine if the current code is running in the Eclipse IDE.
105- * <p>Copied from {@code org.springframework.core.testfixture.ide.IdeUtils}.
106- */
107- static boolean runningInEclipse () {
108- return StackWalker .getInstance ().walk (
109- stream -> stream .anyMatch (stackFrame -> stackFrame .getClassName ().startsWith ("org.eclipse.jdt" )));
110- }
111-
112105}
Original file line number Diff line number Diff line change 2525
2626import org .jspecify .annotations .Nullable ;
2727import org .junit .jupiter .api .Test ;
28+ import org .junit .jupiter .api .condition .DisabledIf ;
2829
2930class ClasspathAlignmentCheckerTests {
3031
@@ -59,6 +60,7 @@ void wrapsLinkageErrorForUnalignedClasspath() {
5960 }
6061
6162 @ Test
63+ @ DisabledIf ("org.junit.platform.commons.test.IdeUtils#runningInEclipse()" )
6264 void allRootPackagesAreChecked () {
6365 var allowedFileNames = Pattern .compile ("junit-(?:platform|jupiter|vintage)-.+[\\ d.]+(?:-SNAPSHOT)?\\ .jar" );
6466 var classGraph = new ClassGraph () //
@@ -83,4 +85,5 @@ void allRootPackagesAreChecked() {
8385 .allMatch (name -> foundPackages .stream ().anyMatch (it -> it .startsWith (name )));
8486 }
8587 }
88+
8689}
You can’t perform that action at this time.
0 commit comments