I have absolutely no idea what I can assert
or verify
in this method. I have two tests written so far which provide 100% coverage, one hits the break and another throws
HttpClientErrorException
which is caught by the catch
. Any ideas much appreciated, I'm currently looking into ways of verifying my log statements but not sure if this is the correct approach..
public void putDataSomewhere(Doc doc) {
for (int i = 0; i < 3; i++) {
try {
OAuth2RestTemplate restTemplate = aUtil.create3RestTemplate(props);
restTemplate.postForEntity(props.getUrl(), doc.toJSONString(), String.class);
log.info("Document [{}] successfully uploaded to Archive", doc.getKey());
break;
} catch (HttpClientErrorException | HttpServerErrorException e) {
log.error("Attempt [{}] failed to send document properties [{}] to Archive", i+1, doc.getKey());
}
}
}
Aucun commentaire:
Enregistrer un commentaire