diff --git a/src/test/java/org/openrewrite/java/dependencies/DependencyListTest.java b/src/test/java/org/openrewrite/java/dependencies/DependencyListTest.java
index ef3d9151..5d9237c1 100644
--- a/src/test/java/org/openrewrite/java/dependencies/DependencyListTest.java
+++ b/src/test/java/org/openrewrite/java/dependencies/DependencyListTest.java
@@ -16,7 +16,9 @@
package org.openrewrite.java.dependencies;
import org.junit.jupiter.api.Test;
+import org.openrewrite.InMemoryExecutionContext;
import org.openrewrite.java.dependencies.table.DependencyListReport;
+import org.openrewrite.maven.MavenExecutionContextView;
import org.openrewrite.maven.tree.*;
import org.openrewrite.test.RecipeSpec;
import org.openrewrite.test.RewriteTest;
@@ -138,6 +140,11 @@ void directOnly() {
void validateResolvable() {
rewriteRun(
spec -> spec.recipe(new DependencyList(DependencyList.Scope.Compile, false, true))
+ // Only the pretend repository below, which can't be reached, is asked: Maven Central and the local
+ // repository, which the recipe would ask too, are left out
+ .executionContext(MavenExecutionContextView.view(new InMemoryExecutionContext())
+ .setAddCentralRepository(false)
+ .setAddLocalRepository(false))
.dataTable(DependencyListReport.Row.class, rows -> assertThat(rows)
.singleElement()
.extracting(DependencyListReport.Row::getResolutionFailure)
diff --git a/src/test/java/org/openrewrite/java/dependencies/DependencyResolutionDiagnosticTest.java b/src/test/java/org/openrewrite/java/dependencies/DependencyResolutionDiagnosticTest.java
index f57bb3e1..6bccfeea 100644
--- a/src/test/java/org/openrewrite/java/dependencies/DependencyResolutionDiagnosticTest.java
+++ b/src/test/java/org/openrewrite/java/dependencies/DependencyResolutionDiagnosticTest.java
@@ -17,7 +17,6 @@
import org.junit.jupiter.api.Test;
import org.openrewrite.DocumentExample;
-import org.openrewrite.ExecutionContext;
import org.openrewrite.InMemoryExecutionContext;
import org.openrewrite.Parser;
import org.openrewrite.java.dependencies.table.RepositoryAccessibilityReport;
@@ -33,6 +32,7 @@
import static org.assertj.core.api.Assertions.assertThat;
import static org.openrewrite.gradle.Assertions.buildGradle;
import static org.openrewrite.gradle.toolingapi.Assertions.withToolingApi;
+import static org.openrewrite.java.dependencies.MavenCentralMirror.settingsMirroringOnlyCentral;
import static org.openrewrite.maven.Assertions.pomXml;
/**
@@ -262,34 +262,4 @@ private static void reachable(RepositoryAccessibilityReport.Row row) {
assertThat(row.getPingHttpCode()).as("what %s answered", row.getUri()).isEqualTo(200);
assertThat(row.getPingExceptionType()).as("what reaching %s threw", row.getUri()).isEmpty();
}
-
- /**
- * Settings with no mirror but one of Maven Central, the mirror CI names in MAVEN_CENTRAL_MIRROR_URL, _USERNAME and
- * _PASSWORD, so that Central is reached as the rest of the build reaches it. With no mirror named, none at all.
- */
- private static MavenSettings settingsMirroringOnlyCentral(ExecutionContext ctx) {
- if (System.getenv("MAVEN_CENTRAL_MIRROR_URL") == null) {
- return new MavenSettings(null, null, null, null, null, null);
- }
- return MavenSettings.parse(new Parser.Input(Path.of("settings.xml"), () -> new ByteArrayInputStream(
- //language=xml
- """
-
+ * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *
+ * https://www.apache.org/licenses/LICENSE-2.0 + *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.openrewrite.java.dependencies;
+
+import org.openrewrite.ExecutionContext;
+import org.openrewrite.Parser;
+import org.openrewrite.maven.MavenSettings;
+
+import java.io.ByteArrayInputStream;
+import java.nio.file.Path;
+
+public final class MavenCentralMirror {
+
+ private MavenCentralMirror() {
+ }
+
+ /**
+ * Settings with no mirror but one of Maven Central, the mirror CI names in MAVEN_CENTRAL_MIRROR_URL, _USERNAME and
+ * _PASSWORD, so that Central is reached as the rest of the build reaches it. With no mirror named, none at all.
+ */
+ public static MavenSettings settingsMirroringOnlyCentral(ExecutionContext ctx) {
+ if (System.getenv("MAVEN_CENTRAL_MIRROR_URL") == null) {
+ return new MavenSettings(null, null, null, null, null, null);
+ }
+ return MavenSettings.parse(new Parser.Input(Path.of("settings.xml"), () -> new ByteArrayInputStream(
+ //language=xml
+ """
+