Skip to content

Commit

Permalink
added raw test in prep for pact producer test
Browse files Browse the repository at this point in the history
  • Loading branch information
ollin committed Feb 26, 2017
1 parent cf339de commit 0c57000
Showing 1 changed file with 31 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package net.nautsch.address.pact;

import org.hamcrest.Matchers;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.embedded.LocalServerPort;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.web.client.TestRestTemplate;
import org.springframework.test.context.junit4.SpringRunner;

import static org.junit.Assert.assertThat;

/**
* running the net.nautsch.address.pact tests against our provider implementation.
*/
@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
public class PactTest {

@LocalServerPort
private int port;

@Autowired
private TestRestTemplate restTemplate;

@Test
public void addressesShouldContainString_Wloka() throws Exception {
assertThat(this.restTemplate.getForObject("http://localhost:" + port + "/addresses", String.class), Matchers.containsString("Wloka"));
}
}

0 comments on commit 0c57000

Please sign in to comment.