.map(e -> new ResponseEntity<>(e, HttpStatus.OK))
.orElseThrow(() -> new RuntimeException("Account update failed"));
}
@RequestMapping(path = "/accounts/{id}")
public ResponseEntity getAccount(@PathVariable Long id) {
<BUG>return Optional.ofNullable(getAccountResource(id))

.map(e -> new ResponseEntity<>(e, HttpStatus.OK))</BUG>
.orElse(new ResponseEntity<>(HttpStatus.NOT_FOUND));
}

.map(e -> new ResponseEntity<>(e, HttpStatus.OK))
.orElseThrow(() -> new RuntimeException("Account update failed"));
}
@RequestMapping(path = "/accounts/{id}")
public ResponseEntity getAccount(@PathVariable Long id) {
return Optional.ofNullable(accountService.get(id))
.map(this::getAccountResource)
.map(e -> new ResponseEntity<>(e, HttpStatus.OK))
.orElse(new ResponseEntity<>(HttpStatus.NOT_FOUND));
}
