Wiremock stubs with cookies + some tests

This commit is contained in:
Marcin Grzejszczak
2018-04-11 10:05:43 +07:00
committed by Alex Xandra Albert Sim
parent e7996e846e
commit a0641790a9
11 changed files with 71 additions and 13 deletions

View File

@@ -86,6 +86,17 @@ public class LoanApplicationService {
return response.getBody().getCount();
}
public String getCookies() {
HttpHeaders httpHeaders = new HttpHeaders();
httpHeaders.add("Cookie", "name=foo");
httpHeaders.add("Cookie", "name2=bar");
ResponseEntity<String> response =
restTemplate.exchange("http://localhost:" + port + "/frauds/name", HttpMethod.GET,
new HttpEntity<>(httpHeaders),
String.class);
return response.getBody();
}
public void setPort(int port) {
this.port = port;
}

View File

@@ -71,4 +71,12 @@ public class LoanApplicationServiceTests {
assertThat(count).isEqualTo(100);
}
@Test
public void shouldSuccessfullyGetCookies() {
// when:
String cookies = service.getCookies();
// then:
assertThat(cookies).isEqualTo("foo bar");
}
}