public void delete(Long id){
Optional<Car> optional = CarRepository.findById(id);
if(optional.isPresent()){
Car car = optional.get();
car.setActionStatus("DELETE");
CarRepository.save(car);
}
else{
throw new CustomException("custom message");
}}
I have to write a unit test for the above delete method, here we are not deleting the record instead we are just updating the setActionStatus to delete.