![JAR search and dependency download from the Maven repository](/logo.png)
com.griddynamics.qa.datapool.matchers.DoesNotContainMatcher Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of data-pool Show documentation
Show all versions of data-pool Show documentation
Test Data Pool tool is intended to mitigate risks of running automated tests against multiple unstable
“FullDB” environments having unpredictable set of data.
The newest version!
package com.griddynamics.qa.datapool.matchers;
import com.griddynamics.qa.datapool.datatype.IDataType;
import com.griddynamics.qa.datapool.DataPoolException;
import com.griddynamics.qa.datapool.IMatcher;
import java.util.Collection;
import java.util.function.Predicate;
/**
* @author Alexey Lyanguzov.
*/
class DoesNotContainMatcher implements IMatcher {
@Override
public Predicate getMatcher(String propName, Object value) {
return (o) -> {
Object obj = o.get(propName, Object.class);
if(obj == null) return true;
if(Collection.class.isAssignableFrom(obj.getClass())){
return !((Collection) obj).contains(value);
}
else if(String.class.isAssignableFrom(obj.getClass())){
return !((String) obj).contains(String.valueOf(value));
}
throw new DataPoolException("Unable to apply matcher %s for type %s", name(), obj.getClass());
};
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy