Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
@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
You can’t perform that action at this time.