
org.mockserver.matchers.HashMapMatcher Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of mockserver-core Show documentation
Show all versions of mockserver-core Show documentation
Functionality used by all MockServer modules for matching and expectations
package org.mockserver.matchers;
import org.mockserver.collections.CaseInsensitiveRegexHashMap;
import org.mockserver.model.KeyAndValue;
import java.util.List;
/**
* @author jamesdbloom
*/
public class HashMapMatcher extends NotMatcher> {
private final CaseInsensitiveRegexHashMap hashMap;
public HashMapMatcher(CaseInsensitiveRegexHashMap hashMap) {
this.hashMap = hashMap;
}
public boolean matches(List values) {
boolean result = false;
if (hashMap == null) {
result = true;
} else if (KeyAndValue.toHashMap(values).containsAll(hashMap)) {
result = true;
} else {
logger.trace("Map [{}] is not a subset of [{}]", this.hashMap, KeyAndValue.toHashMap(values));
}
return reverseResultIfNot(result);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy