My request:
@Test
@Throws(Exception::class)
fun shouldMeIfAccountExistsReturn200() {
val account = accountService.createAccount(AccountSignUpForm("test6", "1234", "test7", false))
val authorities = arrayListOf<String>()
val headers = HttpHeaders()
headers.setAccept(Arrays.asList(MediaType.APPLICATION_JSON))
headers.contentType = MediaType.APPLICATION_JSON
headers.set("Authorization", jwtTokenProvider.createToken(account.username, authorities))
val httpEntity = HttpEntity<String>(headers)
val responseEntity = restTemplate.exchange("http://localhost:$port/api/user/me",HttpMethod.GET,httpEntity, String::class.java )
assertEquals(responseEntity.statusCode, HttpStatus.OK)
}
But ErROR in logs:
2020-06-06 23:24:51.989 DEBUG 26236 --- [o-auto-1-exec-4] o.s.web.servlet.DispatcherServlet : "ERROR" dispatch for GET "/error", parameters={}
what am I doing wrong?( did according to a similar rule: https://o7planning.org/ru/11647/spring-boot-restful-client-with-resttemplate-example
Aucun commentaire:
Enregistrer un commentaire