UnauthorizedException extends RuntimeException implements ErrorCode { @Override public String errorCode() { return "UNAUTHORIZED"; } UnauthorizedException(String message);  UnauthorizedException(String message, Throwable cause); @Override Severity severity(); @Override String errorCode();  }
@Test void errorCode() { var exception = new UnauthorizedException("error"); assertThat(exception.errorCode()).isEqualTo("UNAUTHORIZED"); }