From 33cffed85b926231b3e15040cf64c11630910d9f Mon Sep 17 00:00:00 2001 From: Michael Hoennig Date: Tue, 16 Apr 2024 09:14:08 +0200 Subject: [PATCH] fix Location after add booking item --- .../hsadminng/hs/booking/item/HsBookingItemController.java | 2 +- .../booking/item/HsBookingItemControllerAcceptanceTest.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/net/hostsharing/hsadminng/hs/booking/item/HsBookingItemController.java b/src/main/java/net/hostsharing/hsadminng/hs/booking/item/HsBookingItemController.java index 06926266..57ffefcd 100644 --- a/src/main/java/net/hostsharing/hsadminng/hs/booking/item/HsBookingItemController.java +++ b/src/main/java/net/hostsharing/hsadminng/hs/booking/item/HsBookingItemController.java @@ -60,7 +60,7 @@ public class HsBookingItemController implements HsBookingItemsApi { final var uri = MvcUriComponentsBuilder.fromController(getClass()) - .path("/api/hs/office/bookingItems/{id}") + .path("/api/hs/booking/items/{id}") .buildAndExpand(saved.getUuid()) .toUri(); final var mapped = mapper.map(saved, HsBookingItemResource.class, ENTITY_TO_RESOURCE_POSTMAPPER); diff --git a/src/test/java/net/hostsharing/hsadminng/hs/booking/item/HsBookingItemControllerAcceptanceTest.java b/src/test/java/net/hostsharing/hsadminng/hs/booking/item/HsBookingItemControllerAcceptanceTest.java index 23f61106..fa4ce211 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/booking/item/HsBookingItemControllerAcceptanceTest.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/booking/item/HsBookingItemControllerAcceptanceTest.java @@ -23,7 +23,7 @@ import java.util.UUID; import static java.util.Map.entry; import static net.hostsharing.hsadminng.rbac.test.JsonMatcher.lenientlyEquals; import static org.assertj.core.api.Assertions.assertThat; -import static org.hamcrest.Matchers.startsWith; +import static org.hamcrest.Matchers.matchesRegex; @SpringBootTest( webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, @@ -140,7 +140,7 @@ class HsBookingItemControllerAcceptanceTest extends ContextBasedTestWithCleanup "resources": { "CPU": 12 } } """)) - .header("Location", startsWith("http://localhost")) + .header("Location", matchesRegex("http://localhost:[1-9][0-9]*/api/hs/booking/items/[^/]*")) .extract().header("Location"); // @formatter:on // finally, the new bookingItem can be accessed under the generated UUID