Skip to content

Instantly share code, notes, and snippets.

@chathurangat
Last active May 18, 2018 10:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chathurangat/0b70d184b3837560e26212bcafbd541a to your computer and use it in GitHub Desktop.
Save chathurangat/0b70d184b3837560e26212bcafbd541a to your computer and use it in GitHub Desktop.
@Test
public void testFindUserById4() {
String username = "chathuranga";
String password = "123";
Integer userId = 200;
String url = "http://localhost:" + port + "/users/" + userId;
HttpHeaders requestHeaders = new HttpHeaders();
requestHeaders.setContentType(MediaType.APPLICATION_JSON);
requestHeaders.setAccept(Arrays.asList(MediaType.APPLICATION_JSON));
HttpEntity<AddUserRequest> requestEntity = new HttpEntity<>(requestHeaders);
TestRestTemplate testRestTemplate1 = new TestRestTemplate(username, password, TestRestTemplate.HttpClientOption.ENABLE_COOKIES);
ResponseEntity<FindUserResponse> responseEntity = testRestTemplate1.exchange(
url,
HttpMethod.GET,
requestEntity,
FindUserResponse.class
);
assertNotNull(responseEntity);
assertEquals(HttpStatus.OK, responseEntity.getStatusCode());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment