ServiceException extends Exception { public static <T extends ServiceException> T withLogLevel(T exception, Level level) { exception.logLevel = level; return exception; } ServiceException(int statusCode, String statusMessage);  ServiceException(int statusCode, Throwable cause);  ServiceException(int statusCode, String statusMessage, Throwable cause);  ServiceException(int statusCode, String statusMessage, String reason);  ServiceException(int statusCode, String statusMessage, String reason, Throwable cause);  ServiceException(int statusCode, String statusMessage, String reason, String domain);  ServiceException(int statusCode, String statusMessage, String reason, String domain, 
      Throwable cause); int getStatusCode(); String getReason(); String getDomain(); Map<String, String> getHeaders(); Level getLogLevel(); static T withLogLevel(T exception, Level level);  }
@Test public void testWithLogLevel() { UnauthorizedException ex = new UnauthorizedException(""); assertThat(ex.getLogLevel()).isEqualTo(Level.INFO); assertThat(ServiceException.withLogLevel(ex, Level.WARNING).getLogLevel()) .isEqualTo(Level.WARNING); }