@Test public void testFormatLogMessage_message_is_empty() { String code = "code"; String message = ""; String actualLogMessage = testTarget.formatLogMessage(code, message); String expectedLogMessage = "[" + code + "] UNDEFINED-MESSAGE"; assertThat(actualLogMessage, is(expectedLogMessage)); }
protected String formatLogMessage(String exceptionCode, String exceptionMessage) { String bindingExceptionCode = exceptionCode; String bindingExceptionMessage = exceptionMessage; if (StringUtils.isEmpty(bindingExceptionCode)) { bindingExceptionCode = defaultCode; } if (StringUtils.isEmpty(bindingExceptionMessage)) { bindingExceptionMessage = defaultMessage; } String message = MessageFormat.format(logMessageFormat, bindingExceptionCode, bindingExceptionMessage); if (trimLogMessage) { message = message.trim(); } return message; }
ExceptionLogger implements InitializingBean { protected String formatLogMessage(String exceptionCode, String exceptionMessage) { String bindingExceptionCode = exceptionCode; String bindingExceptionMessage = exceptionMessage; if (StringUtils.isEmpty(bindingExceptionCode)) { bindingExceptionCode = defaultCode; } if (StringUtils.isEmpty(bindingExceptionMessage)) { bindingExceptionMessage = defaultMessage; } String message = MessageFormat.format(logMessageFormat, bindingExceptionCode, bindingExceptionMessage); if (trimLogMessage) { message = message.trim(); } return message; } }
ExceptionLogger implements InitializingBean { protected String formatLogMessage(String exceptionCode, String exceptionMessage) { String bindingExceptionCode = exceptionCode; String bindingExceptionMessage = exceptionMessage; if (StringUtils.isEmpty(bindingExceptionCode)) { bindingExceptionCode = defaultCode; } if (StringUtils.isEmpty(bindingExceptionMessage)) { bindingExceptionMessage = defaultMessage; } String message = MessageFormat.format(logMessageFormat, bindingExceptionCode, bindingExceptionMessage); if (trimLogMessage) { message = message.trim(); } return message; } ExceptionLogger();  ExceptionLogger(String name); }
ExceptionLogger implements InitializingBean { protected String formatLogMessage(String exceptionCode, String exceptionMessage) { String bindingExceptionCode = exceptionCode; String bindingExceptionMessage = exceptionMessage; if (StringUtils.isEmpty(bindingExceptionCode)) { bindingExceptionCode = defaultCode; } if (StringUtils.isEmpty(bindingExceptionMessage)) { bindingExceptionMessage = defaultMessage; } String message = MessageFormat.format(logMessageFormat, bindingExceptionCode, bindingExceptionMessage); if (trimLogMessage) { message = message.trim(); } return message; } ExceptionLogger();  ExceptionLogger(String name); void setExceptionCodeResolver(
            ExceptionCodeResolver exceptionCodeResolver); void setExceptionLevelResolver(
            ExceptionLevelResolver exceptionLevelResolver); void setLogMessageFormat(String logMessageFormat); void setTrimLogMessage(boolean trimLogMessage); void setDefaultCode(String defaultCode); void setDefaultMessage(String defaultMessage); @Override void afterPropertiesSet(); void log(Exception ex); void info(Exception ex); void warn(Exception ex); void error(Exception ex); }
ExceptionLogger implements InitializingBean { protected String formatLogMessage(String exceptionCode, String exceptionMessage) { String bindingExceptionCode = exceptionCode; String bindingExceptionMessage = exceptionMessage; if (StringUtils.isEmpty(bindingExceptionCode)) { bindingExceptionCode = defaultCode; } if (StringUtils.isEmpty(bindingExceptionMessage)) { bindingExceptionMessage = defaultMessage; } String message = MessageFormat.format(logMessageFormat, bindingExceptionCode, bindingExceptionMessage); if (trimLogMessage) { message = message.trim(); } return message; } ExceptionLogger();  ExceptionLogger(String name); void setExceptionCodeResolver(
            ExceptionCodeResolver exceptionCodeResolver); void setExceptionLevelResolver(
            ExceptionLevelResolver exceptionLevelResolver); void setLogMessageFormat(String logMessageFormat); void setTrimLogMessage(boolean trimLogMessage); void setDefaultCode(String defaultCode); void setDefaultMessage(String defaultMessage); @Override void afterPropertiesSet(); void log(Exception ex); void info(Exception ex); void warn(Exception ex); void error(Exception ex);  }