MessageMap implements Serializable { public boolean containsKeyMatchingPattern(String pattern) { List<String> simplePatterns = new ArrayList<String>(); List<String> wildcardPatterns = new ArrayList<String>(); String[] patterns = pattern.split(","); for (int i = 0; i < patterns.length; i++) { String s = patterns[i]; if (s.endsWith("*")) { wildcardPatterns.add(s.substring(0, s.length() - 1)); } else { simplePatterns.add(s); } } for (Iterator<String> keys = errorMessages.keySet().iterator(); keys.hasNext(); ) { String key = keys.next(); if (simplePatterns.contains(key)) { return true; } for (Iterator<String> wildcardIterator = wildcardPatterns.iterator(); wildcardIterator.hasNext(); ) { String wildcard = wildcardIterator.next(); if (key.startsWith(wildcard)) { return true; } } } return false; } MessageMap();  MessageMap(MessageMap messageMap); void merge(MessageMap messageMap); void merge(Map<String, List<ErrorMessage>> messagesFrom,
            Map<String, List<ErrorMessage>> messagesTo); List<ErrorMessage> putError(String propertyName, String errorKey, String... errorParameters); List<ErrorMessage> putWarning(String propertyName, String messageKey,
            String... messageParameters); List<ErrorMessage> putInfo(String propertyName, String messageKey,
            String... messageParameters); List<ErrorMessage> putError(String propertyName, ErrorMessage message); List<ErrorMessage> putWarning(String propertyName, ErrorMessage message); List<ErrorMessage> putInfo(String propertyName, ErrorMessage message); List<ErrorMessage> putErrorWithoutFullErrorPath(String propertyName, String errorKey,
            String... errorParameters); List<ErrorMessage> putWarningWithoutFullErrorPath(String propertyName, String messageKey,
            String... messageParameters); List<ErrorMessage> putInfoWithoutFullErrorPath(String propertyName, String messageKey,
            String... messageParameters); List<ErrorMessage> putErrorWithoutFullErrorPath(String propertyName, ErrorMessage message); List<ErrorMessage> putWarningWithoutFullErrorPath(String propertyName, ErrorMessage message); List<ErrorMessage> putInfoWithoutFullErrorPath(String propertyName, ErrorMessage message); List<ErrorMessage> putErrorForSectionId(String sectionId, String errorKey,
            String... errorParameters); List<ErrorMessage> putWarningForSectionId(String sectionId, String messageKey,
            String... messageParameters); List<ErrorMessage> putInfoForSectionId(String sectionId, String messageKey,
            String... messageParameters); List<ErrorMessage> putErrorForSectionId(String sectionId, ErrorMessage message); List<ErrorMessage> putWarningForSectionId(String sectionId, ErrorMessage message); List<ErrorMessage> putInfoForSectionId(String sectionId, ErrorMessage message); List<ErrorMessage> putError(String propertyName, String errorKey, Boolean escapeHtmlMessageParameters, String... errorParameters); List<ErrorMessage> putWarning(String propertyName, String messageKey, Boolean escapeHtmlMessageParameters,
            String... messageParameters); List<ErrorMessage> putInfo(String propertyName, String messageKey, Boolean escapeHtmlMessageParameters,
            String... messageParameters); void addGrowlMessage(String growlTitle, String messageKey, String... messageParameters); void addGrowlMessage(GrowlMessage growl); boolean replaceError(String propertyName, String targetKey, String replaceKey, String... replaceParameters); boolean replaceErrorWithoutFullErrorPath(String propertyName, String targetKey, String replaceKey,
            String... replaceParameters); boolean fieldHasMessage(String fieldName, String errorKey); int countFieldMessages(String fieldName); boolean containsMessageKey(String messageKey); int getErrorCount(); int getWarningCount(); int getInfoCount(); List<ErrorMessage> getMessages(String path); void addToErrorPath(String parentName); List<String> getErrorPath(); boolean removeFromErrorPath(String parentName); void clearErrorPath(); String getKeyPath(String propertyName, boolean prependFullErrorPath); List<String> getPropertiesWithErrors(); List<String> getPropertiesWithWarnings(); List<String> getPropertiesWithInfo(); void clearErrorMessages(); boolean doesPropertyHaveError(String key); boolean containsKeyMatchingPattern(String pattern); Set<Map.Entry<String, List<ErrorMessage>>> getAllPropertiesAndErrors(); List<ErrorMessage> getErrorMessagesForProperty(String propertyName); List<ErrorMessage> getWarningMessagesForProperty(String propertyName); List<ErrorMessage> getInfoMessagesForProperty(String propertyName); List<List<ErrorMessage>> getErrorMessagesForProperty(String propertyName,
            boolean allowWildcard); List<List<ErrorMessage>> getWarningMessagesForProperty(String propertyName,
            boolean allowWildcard); List<List<ErrorMessage>> getInfoMessagesForProperty(String propertyName,
            boolean allowWildcard); boolean hasErrors(); boolean hasNoErrors(); boolean hasWarnings(); boolean hasNoWarnings(); boolean hasInfo(); boolean hasNoInfo(); boolean hasMessages(); boolean hasNoMessages(); Set<String> getAllPropertiesWithErrors(); Set<String> getAllPropertiesWithWarnings(); Set<String> getAllPropertiesWithInfo(); List<ErrorMessage> removeAllErrorMessagesForProperty(String property); List<ErrorMessage> removeAllWarningMessagesForProperty(String property); List<ErrorMessage> removeAllInfoMessagesForProperty(String property); int getNumberOfPropertiesWithErrors(); Map<String, List<ErrorMessage>> getErrorMessages(); Map<String, List<ErrorMessage>> getWarningMessages(); Map<String, List<ErrorMessage>> getInfoMessages(); List<GrowlMessage> getGrowlMessages(); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString();  }
@Test public void testContainsKeyMatchingPattern_mixedList_empty() { assertEquals(false, new MessageMap().containsKeyMatchingPattern(MIXED_LIST_PATTERN)); }