Skip to content

Commit

Permalink
fixing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
paulsmelser committed Oct 19, 2017
1 parent 1fadc8f commit f5d3311
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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<AzureResourcePricing> azurePricing = pricingTemplate.getAzurePricing();

SoftAssertions.assertSoftly(softly -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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(
Expand Down

0 comments on commit f5d3311

Please sign in to comment.