InvalidPasswordException extends ScimException { public String getMessagesAsOneString() { ArrayList<String> sortedMessages = new ArrayList<String>(errorMessages); Collections.sort(sortedMessages); return StringUtils.collectionToDelimitedString(sortedMessages, " "); } InvalidPasswordException(String message);  InvalidPasswordException(List<String> errorMessages);  InvalidPasswordException(String message, HttpStatus httpStatus); List<String> getErrorMessages(); String getMessagesAsOneString(); @Override String getMessage();  }
@Test public void errorMessagesEmitInSortedOrder() { InvalidPasswordException exception = new InvalidPasswordException(Arrays.asList("a2", "b1", "a1")); assertEquals("a1 a2 b1", exception.getMessagesAsOneString()); }