SimpleMappingExceptionCodeResolver implements
                                                ExceptionCodeResolver { @Override public String resolveExceptionCode(Exception ex) { if (ex == null) { logger.warn( "target exception is null. return defaultExceptionCode."); return defaultExceptionCode; } if (ex instanceof ExceptionCodeProvider) { String code = ((ExceptionCodeProvider) ex).getCode(); if (code != null) { return code; } } if (exceptionMappings == null || exceptionMappings.isEmpty()) { return defaultExceptionCode; } for (Entry<String, String> entry : exceptionMappings.entrySet()) { String targetException = entry.getKey(); Class<?> exceptionClass = ex.getClass(); while (exceptionClass != Object.class) { if (exceptionClass.getName().contains(targetException)) { return entry.getValue(); } exceptionClass = exceptionClass.getSuperclass(); } } return defaultExceptionCode; }  void setExceptionMappings(
            LinkedHashMap<String, String> exceptionMappings); void setDefaultExceptionCode(String defaultExceptionCode); @Override String resolveExceptionCode(Exception ex);  }
@Test public void testResolveExceptionCode_systemexception_exists_code() { String actualExceptionCode1 = testTarget.resolveExceptionCode( new SystemException("testcode001", "testmessage001")); String actualExceptionCode2 = testTarget.resolveExceptionCode( new SystemException("testcode002", "testmessage002")); assertThat(actualExceptionCode1, is("testcode001")); assertThat(actualExceptionCode2, is("testcode002")); }