diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationRoute53RecordSetIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationRoute53RecordSetIntegrationTest.java
index e2d09f5fba..6b5fd4892b 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationRoute53RecordSetIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationRoute53RecordSetIntegrationTest.java
@@ -1,6 +1,7 @@
package io.github.hectorvent.floci.services.cloudformation;
import io.github.hectorvent.floci.core.common.AwsException;
+import io.github.hectorvent.floci.services.route53.Route53HostedZoneTestSupport;
import io.github.hectorvent.floci.services.route53.Route53Service;
import io.github.hectorvent.floci.testing.CfnStackWaits;
import io.github.hectorvent.floci.testing.RestAssuredJsonUtils;
@@ -234,20 +235,7 @@ class CloudFormationRoute53RecordSetIntegrationTest {
}
private String createHostedZone(String zoneName, String callerReference) {
- String location = given()
- .contentType("application/xml")
- .header("Authorization", ROUTE53_AUTH)
- .body("""
-
-
- %s
- %s
-
- """.formatted(zoneName, callerReference))
- .when().post("/2013-04-01/hostedzone")
- .then().statusCode(201)
- .extract().header("Location");
- return location.substring(location.lastIndexOf('/') + 1);
+ return Route53HostedZoneTestSupport.createZone(zoneName, callerReference, ROUTE53_AUTH);
}
private void changeRecordSet(String zoneId, String action, String name, String address) {
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
index f389b195c2..b422af5d9a 100644
--- a/src/test/java/io/github/hectorvent/floci/services/route53/Route53HostedZoneTestSupport.java
+++ b/src/test/java/io/github/hectorvent/floci/services/route53/Route53HostedZoneTestSupport.java
@@ -1,19 +1,29 @@
package io.github.hectorvent.floci.services.route53;
+import io.restassured.specification.RequestSpecification;
+
import static io.restassured.RestAssured.given;
-final class Route53HostedZoneTestSupport {
+public final class Route53HostedZoneTestSupport {
private Route53HostedZoneTestSupport() {}
- static String createZone(String name, String callerReference) {
+ public static String createZone(String name, String callerReference) {
+ return createZone(name, callerReference, null);
+ }
+
+ public static String createZone(String name, String callerReference, String authorization) {
String request = """
%s
%s
""".formatted(name, callerReference);
- String location = given().contentType("application/xml").body(request)
+ RequestSpecification specification = given().contentType("application/xml").body(request);
+ if (authorization != null) {
+ specification.header("Authorization", authorization);
+ }
+ String location = specification
.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/ses/SesDomainIdentityTestHelper.java b/src/test/java/io/github/hectorvent/floci/services/ses/SesDomainIdentityTestHelper.java
index 7ad317cca5..a3317a3813 100644
--- a/src/test/java/io/github/hectorvent/floci/services/ses/SesDomainIdentityTestHelper.java
+++ b/src/test/java/io/github/hectorvent/floci/services/ses/SesDomainIdentityTestHelper.java
@@ -1,5 +1,7 @@
package io.github.hectorvent.floci.services.ses;
+import io.github.hectorvent.floci.services.route53.Route53HostedZoneTestSupport;
+
import java.util.List;
import java.util.UUID;
@@ -33,21 +35,7 @@ final class SesDomainIdentityTestHelper {
}
static String publishDkimRecords(String domain, List tokens) {
- String location = given()
- .contentType("application/xml")
- .body("""
-
-
- %s
- %s
-
- """.formatted(domain, UUID.randomUUID()))
- .when()
- .post("/2013-04-01/hostedzone")
- .then()
- .statusCode(201)
- .extract()
- .header("Location");
+ String zoneId = Route53HostedZoneTestSupport.createZone(domain, UUID.randomUUID().toString());
StringBuilder changes = new StringBuilder();
for (String token : tokens) {
@@ -65,7 +53,6 @@ final class SesDomainIdentityTestHelper {
""".formatted(token, domain, token));
}
- String zoneId = location.substring(location.lastIndexOf('/') + 1);
given()
.contentType("application/xml")
.body("""