org.springframework.web.client.RestClientException: Error while extracting response for type [class java.lang.Long] and content type [application/json]; nested exception is org.springframework.http.converter.HttpMessageNotReadableException: JSON parse error: Cannot deserialize value of type `java.lang.Long` from Object value (token `JsonToken.START_OBJECT`); nested exception is com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize value of type `java.lang.Long` from Object value (token `JsonToken.START_OBJECT`)
at [Source: (org.springframework.util.StreamUtils$NonClosingInputStream); line: 1, column: 1]
PostsApiControllerTest Posts_수정된다() Run 돌리니까 위의 에러가 났다. 구글링의 해결책으로는 내 오류가 해결되지 않았다. 책 저자가 관련 메소드에서 Post를 Put으로 오타 실수가 있었다기에 혹시나하고 다음과 같이 수정하니 에러 해결.
ResponseEntity<Long> responseEntity = restTemplate.exchange(url, HttpMethod.PUT, requestEntity,Long.class);
ResponseEntity<Long> responseEntity = restTemplate.exchange(url, HttpMethod.PUT, requestEntity,Long.class);
수정 전 소스와 수정 후 소스가 차이가 없습니다.