From 358f34b72f9dc6cd5cd9173de8acedaf393e8072 Mon Sep 17 00:00:00 2001
From: Jimmy Liu Jia <91264074+JimmyLiuJia@users.noreply.github.com>
Date: Fri, 30 Oct 2026 09:53:52 +0800
Subject: [PATCH] test(route53): share hosted zone creation helper (#6973)
---
...angeResourceRecordSetsIntegrationTest.java | 14 +------------
.../route53/Route53HostedZoneTestSupport.java | 21 +++++++++++++++++++
...3HostedZonesPaginationIntegrationTest.java | 14 +------------
3 files changed, 23 insertions(+), 26 deletions(-)
create mode 100644 src/test/java/io/github/hectorvent/floci/services/route53/Route53HostedZoneTestSupport.java
diff --git a/src/test/java/io/github/hectorvent/floci/services/route53/Route53ChangeResourceRecordSetsIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/route53/Route53ChangeResourceRecordSetsIntegrationTest.java
index c020e44d0e..54f2bb5793 100644
--- a/src/test/java/io/github/hectorvent/floci/services/route53/Route53ChangeResourceRecordSetsIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/route53/Route53ChangeResourceRecordSetsIntegrationTest.java
@@ -8,6 +8,7 @@ import org.junit.jupiter.params.provider.MethodSource;
import java.util.stream.Stream;
+import static io.github.hectorvent.floci.services.route53.Route53HostedZoneTestSupport.createZone;
import static io.restassured.RestAssured.given;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.equalTo;
@@ -398,17 +399,4 @@ class Route53ChangeResourceRecordSetsIntegrationTest {
Arguments.of("EmptyChanges", emptyChanges),
Arguments.of("NoChangeBatch", noChangeBatch));
}
-
- private static String createZone(String name, String callerReference) {
- String create = """
-
- %s
- %s
-
- """.formatted(name, callerReference);
- String location = given().contentType(XML).body(create)
- .post("/2013-04-01/hostedzone")
- .then().statusCode(201).extract().header("Location");
- return location.substring(location.lastIndexOf('/') + 1);
- }
}
diff --git a/src/test/java/io/github/hectorvent/floci/services/route53/Route53HostedZoneTestSupport.java b/src/test/java/io/github/hectorvent/floci/services/route53/Route53HostedZoneTestSupport.java
new file mode 100644
index 0000000000..f389b195c2
--- /dev/null
+++ b/src/test/java/io/github/hectorvent/floci/services/route53/Route53HostedZoneTestSupport.java
@@ -0,0 +1,21 @@
+package io.github.hectorvent.floci.services.route53;
+
+import static io.restassured.RestAssured.given;
+
+final class Route53HostedZoneTestSupport {
+
+ private Route53HostedZoneTestSupport() {}
+
+ static String createZone(String name, String callerReference) {
+ String request = """
+
+ %s
+ %s
+
+ """.formatted(name, callerReference);
+ String location = given().contentType("application/xml").body(request)
+ .post("/2013-04-01/hostedzone")
+ .then().statusCode(201).extract().header("Location");
+ return location.substring(location.lastIndexOf('/') + 1);
+ }
+}
diff --git a/src/test/java/io/github/hectorvent/floci/services/route53/Route53HostedZonesPaginationIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/route53/Route53HostedZonesPaginationIntegrationTest.java
index 619103ecfe..cdf1ec65e8 100644
--- a/src/test/java/io/github/hectorvent/floci/services/route53/Route53HostedZonesPaginationIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/route53/Route53HostedZonesPaginationIntegrationTest.java
@@ -117,18 +117,6 @@ class Route53HostedZonesPaginationIntegrationTest {
}
private String createZone(String name) {
- String request = """
-
- %s
- pagination-%s-%s
-
- """.formatted(name, name, System.nanoTime());
- String location = given()
- .contentType("application/xml")
- .body(request)
- .when().post("/2013-04-01/hostedzone")
- .then().statusCode(201)
- .extract().header("Location");
- return location.substring(location.lastIndexOf('/') + 1);
+ return Route53HostedZoneTestSupport.createZone(name, "pagination-" + name + "-" + System.nanoTime());
}
}