@Test(expected = IllegalArgumentException.class) public void getMessageKeyByExceptionShouldThrowIllegalArgumentExceptionWhenExceptionIsNull() throws IllegalArgumentException { ruleValidationExceptionMapper.getMessageKeyByException(null); }
@Override public String getMessageKeyByException(Exception e) throws IllegalArgumentException { Assert.notNull(e); Class<? extends Exception> exceptionClass = e.getClass(); for (ExceptionMessagePair exceptionMessagePair : ruleValidationExceptionSet) { if (exceptionClass.equals(exceptionMessagePair.getExceptionClass())) { return exceptionMessagePair.getMessageKey(); } } throw new IllegalArgumentException(); }
RuleValidationExceptionMapperImpl implements RuleValidationExceptionMapper { @Override public String getMessageKeyByException(Exception e) throws IllegalArgumentException { Assert.notNull(e); Class<? extends Exception> exceptionClass = e.getClass(); for (ExceptionMessagePair exceptionMessagePair : ruleValidationExceptionSet) { if (exceptionClass.equals(exceptionMessagePair.getExceptionClass())) { return exceptionMessagePair.getMessageKey(); } } throw new IllegalArgumentException(); } }
RuleValidationExceptionMapperImpl implements RuleValidationExceptionMapper { @Override public String getMessageKeyByException(Exception e) throws IllegalArgumentException { Assert.notNull(e); Class<? extends Exception> exceptionClass = e.getClass(); for (ExceptionMessagePair exceptionMessagePair : ruleValidationExceptionSet) { if (exceptionClass.equals(exceptionMessagePair.getExceptionClass())) { return exceptionMessagePair.getMessageKey(); } } throw new IllegalArgumentException(); }  }
RuleValidationExceptionMapperImpl implements RuleValidationExceptionMapper { @Override public String getMessageKeyByException(Exception e) throws IllegalArgumentException { Assert.notNull(e); Class<? extends Exception> exceptionClass = e.getClass(); for (ExceptionMessagePair exceptionMessagePair : ruleValidationExceptionSet) { if (exceptionClass.equals(exceptionMessagePair.getExceptionClass())) { return exceptionMessagePair.getMessageKey(); } } throw new IllegalArgumentException(); }  @Override String getMessageKeyByException(Exception e); }
RuleValidationExceptionMapperImpl implements RuleValidationExceptionMapper { @Override public String getMessageKeyByException(Exception e) throws IllegalArgumentException { Assert.notNull(e); Class<? extends Exception> exceptionClass = e.getClass(); for (ExceptionMessagePair exceptionMessagePair : ruleValidationExceptionSet) { if (exceptionClass.equals(exceptionMessagePair.getExceptionClass())) { return exceptionMessagePair.getMessageKey(); } } throw new IllegalArgumentException(); }  @Override String getMessageKeyByException(Exception e);  }