diff --git a/src/test/java/org/springframework/social/partnercenter/api/billing/pricing/PricingOperationsTest.java b/src/test/java/org/springframework/social/partnercenter/api/billing/pricing/PricingOperationsTest.java index f2ff06b..fa0a7f7 100644 --- a/src/test/java/org/springframework/social/partnercenter/api/billing/pricing/PricingOperationsTest.java +++ b/src/test/java/org/springframework/social/partnercenter/api/billing/pricing/PricingOperationsTest.java @@ -1,8 +1,8 @@ package org.springframework.social.partnercenter.api.billing.pricing; +import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.options; import static org.springframework.social.partnercenter.test.stubs.PricingOperationsStubs.given_getAzurePricing_200_OK; -import java.net.URI; import java.time.Instant; import java.time.ZonedDateTime; import java.util.Locale; @@ -13,18 +13,19 @@ import org.springframework.http.ResponseEntity; import org.springframework.social.partnercenter.api.billing.pricing.impl.PricingTemplate; import org.springframework.social.partnercenter.http.client.RestClient; +import org.springframework.social.partnercenter.test.stubs.StubURI; import org.springframework.social.partnercenter.test.stubs.TestRestTemplateFactory; import com.github.tomakehurst.wiremock.junit.WireMockRule; public class PricingOperationsTest { @Rule - public WireMockRule wireMockRule = new WireMockRule(); + public WireMockRule wireMockRule = new WireMockRule(options().dynamicPort()); @Test public void testGetAzurePricing_whenCalled_thenResponseIsParsedCorrectly() { given_getAzurePricing_200_OK(); - final PricingTemplate pricingTemplate = new PricingTemplate(new RestClient(TestRestTemplateFactory.createRestTemplate(), URI.create("http://localhost:8080/v1/ratecards/azure")), true); + final PricingTemplate pricingTemplate = new PricingTemplate(new RestClient(TestRestTemplateFactory.createRestTemplate(), StubURI.baseURI(wireMockRule.port(), "v1", "ratecards", "azure")), true); final ResponseEntity azurePricing = pricingTemplate.getAzurePricing(); SoftAssertions.assertSoftly(softly -> { diff --git a/src/test/java/org/springframework/social/partnercenter/api/order/subscription/SubscriptionOperationsTest.java b/src/test/java/org/springframework/social/partnercenter/api/order/subscription/SubscriptionOperationsTest.java index aec6d85..2aec2af 100644 --- a/src/test/java/org/springframework/social/partnercenter/api/order/subscription/SubscriptionOperationsTest.java +++ b/src/test/java/org/springframework/social/partnercenter/api/order/subscription/SubscriptionOperationsTest.java @@ -10,7 +10,6 @@ import static org.springframework.social.partnercenter.test.stubs.SubscriptionOperationStubs.given_patch_200_OK; import static org.springframework.social.partnercenter.test.stubs.TestRestTemplateFactory.createRestTemplate; -import java.net.URI; import java.time.format.DateTimeFormatter; import org.assertj.core.api.SoftAssertions; @@ -31,7 +30,7 @@ public void testById_whenCalled_thenResponseIsParsedCorrectly() { given_getById_200_OK(); final SubscriptionOperations subscriptionOperations = new SubscriptionTemplate( - new RestClient(createRestTemplate(),URI.create("http://localhost:8089/v1/customers")), + new RestClient(createRestTemplate(), baseURI(wireMockRule.port(), "v1", "customers")), true); final Subscription subscription = subscriptionOperations.getById(