Last active
May 18, 2018 10:35
-
-
Save chathurangat/0b70d184b3837560e26212bcafbd541a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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