@Test public void testValidationException() { ValidationException parent = new ValidationException("Key 1"); ValidationException child = new ValidationException("Key 2"); parent.addChildException(child); ValidationExceptionMessageExtractor extractor = new ValidationExceptionMessageExtractor(); extractor.extract(context, parent); verify(context).addMessage(any(MessageResolver.class)); }
public void extract(MessageContext context, ValidationException e) { if (e.hasChildExceptions()) { List<ValidationException> children = e.getChildExceptions(); for (ValidationException child : children) { if (child instanceof BadNumericResponseException) { extractBadNumericResponseException(context, (BadNumericResponseException) child); } else if (child instanceof MandatoryAnswerNotFoundException) { extractMandatoryAnswerNotFoundException(context, (MandatoryAnswerNotFoundException) child); } else { extractDefault(context, child); } } } }
ValidationExceptionMessageExtractor { public void extract(MessageContext context, ValidationException e) { if (e.hasChildExceptions()) { List<ValidationException> children = e.getChildExceptions(); for (ValidationException child : children) { if (child instanceof BadNumericResponseException) { extractBadNumericResponseException(context, (BadNumericResponseException) child); } else if (child instanceof MandatoryAnswerNotFoundException) { extractMandatoryAnswerNotFoundException(context, (MandatoryAnswerNotFoundException) child); } else { extractDefault(context, child); } } } } }
ValidationExceptionMessageExtractor { public void extract(MessageContext context, ValidationException e) { if (e.hasChildExceptions()) { List<ValidationException> children = e.getChildExceptions(); for (ValidationException child : children) { if (child instanceof BadNumericResponseException) { extractBadNumericResponseException(context, (BadNumericResponseException) child); } else if (child instanceof MandatoryAnswerNotFoundException) { extractMandatoryAnswerNotFoundException(context, (MandatoryAnswerNotFoundException) child); } else { extractDefault(context, child); } } } }  }
ValidationExceptionMessageExtractor { public void extract(MessageContext context, ValidationException e) { if (e.hasChildExceptions()) { List<ValidationException> children = e.getChildExceptions(); for (ValidationException child : children) { if (child instanceof BadNumericResponseException) { extractBadNumericResponseException(context, (BadNumericResponseException) child); } else if (child instanceof MandatoryAnswerNotFoundException) { extractMandatoryAnswerNotFoundException(context, (MandatoryAnswerNotFoundException) child); } else { extractDefault(context, child); } } } }  void extract(MessageContext context, ValidationException e); }
ValidationExceptionMessageExtractor { public void extract(MessageContext context, ValidationException e) { if (e.hasChildExceptions()) { List<ValidationException> children = e.getChildExceptions(); for (ValidationException child : children) { if (child instanceof BadNumericResponseException) { extractBadNumericResponseException(context, (BadNumericResponseException) child); } else if (child instanceof MandatoryAnswerNotFoundException) { extractMandatoryAnswerNotFoundException(context, (MandatoryAnswerNotFoundException) child); } else { extractDefault(context, child); } } } }  void extract(MessageContext context, ValidationException e);  }