I am using RestTemplate postForEntity
method to post to an endpoint. If POST
is successful then it returns status code of 201
. I need help to write test case for this method using Mockito
. Any suggestions are appreciated. Thank you
Here is my code
public int postJson(Set<String> last){
try{
LOGGER.info("Status code " + statusCode);
} catch (Exception e) {
e.printStackTrace();
}
return statusCode;
}
private HttpEntity getHttpEntity() {
return new HttpEntity<>( null, getHttpHeaders() );
}
private HttpHeaders getHttpHeaders() {
return headersBuilder.build();
}