@Test void testGetErrorsEmpty() { assertEquals(empty(), getErrors(mock(Throwable.class))); }
static Optional<Errors> getErrors(Throwable throwable) { Optional<Errors> errors; if (throwable instanceof Errors) { errors = Optional.of((Errors) throwable); } else if (throwable instanceof MethodArgumentNotValidException) { errors = Optional.of(((MethodArgumentNotValidException) throwable).getBindingResult()); } else { errors = Optional.empty(); } return errors; }
ExceptionUtils { static Optional<Errors> getErrors(Throwable throwable) { Optional<Errors> errors; if (throwable instanceof Errors) { errors = Optional.of((Errors) throwable); } else if (throwable instanceof MethodArgumentNotValidException) { errors = Optional.of(((MethodArgumentNotValidException) throwable).getBindingResult()); } else { errors = Optional.empty(); } return errors; } }
ExceptionUtils { static Optional<Errors> getErrors(Throwable throwable) { Optional<Errors> errors; if (throwable instanceof Errors) { errors = Optional.of((Errors) throwable); } else if (throwable instanceof MethodArgumentNotValidException) { errors = Optional.of(((MethodArgumentNotValidException) throwable).getBindingResult()); } else { errors = Optional.empty(); } return errors; } private  ExceptionUtils(); }
ExceptionUtils { static Optional<Errors> getErrors(Throwable throwable) { Optional<Errors> errors; if (throwable instanceof Errors) { errors = Optional.of((Errors) throwable); } else if (throwable instanceof MethodArgumentNotValidException) { errors = Optional.of(((MethodArgumentNotValidException) throwable).getBindingResult()); } else { errors = Optional.empty(); } return errors; } private  ExceptionUtils();  }
ExceptionUtils { static Optional<Errors> getErrors(Throwable throwable) { Optional<Errors> errors; if (throwable instanceof Errors) { errors = Optional.of((Errors) throwable); } else if (throwable instanceof MethodArgumentNotValidException) { errors = Optional.of(((MethodArgumentNotValidException) throwable).getBindingResult()); } else { errors = Optional.empty(); } return errors; } private  ExceptionUtils();   }