Wiremock stubs with cookies + some tests
This commit is contained in:
committed by
Alex Xandra Albert Sim
parent
e7996e846e
commit
a0641790a9
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user