@Test void testGetErrorCodeNotExists() { Exception e = mock(Exception.class); assertEquals(empty(), getErrorCode(e)); }
static Optional<String> getErrorCode(Throwable throwable) { Optional<String> errorCode; if (throwable instanceof ErrorCoded) { errorCode = Optional.of(((ErrorCoded) throwable).getErrorCode()); } else { errorCode = Optional.empty(); } return errorCode; }
ExceptionUtils { static Optional<String> getErrorCode(Throwable throwable) { Optional<String> errorCode; if (throwable instanceof ErrorCoded) { errorCode = Optional.of(((ErrorCoded) throwable).getErrorCode()); } else { errorCode = Optional.empty(); } return errorCode; } }
ExceptionUtils { static Optional<String> getErrorCode(Throwable throwable) { Optional<String> errorCode; if (throwable instanceof ErrorCoded) { errorCode = Optional.of(((ErrorCoded) throwable).getErrorCode()); } else { errorCode = Optional.empty(); } return errorCode; } private  ExceptionUtils(); }
ExceptionUtils { static Optional<String> getErrorCode(Throwable throwable) { Optional<String> errorCode; if (throwable instanceof ErrorCoded) { errorCode = Optional.of(((ErrorCoded) throwable).getErrorCode()); } else { errorCode = Optional.empty(); } return errorCode; } private  ExceptionUtils();  }
ExceptionUtils { static Optional<String> getErrorCode(Throwable throwable) { Optional<String> errorCode; if (throwable instanceof ErrorCoded) { errorCode = Optional.of(((ErrorCoded) throwable).getErrorCode()); } else { errorCode = Optional.empty(); } return errorCode; } private  ExceptionUtils();   }