com.github.dakusui.lisj.pred.Matches Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jcunit Show documentation
Show all versions of jcunit Show documentation
Automated combinatorial testing framework on top of JUnit
package com.github.dakusui.lisj.pred;
import static com.github.dakusui.lisj.Basic.get;
import com.github.dakusui.jcunit.core.Utils;
import com.github.dakusui.lisj.Context;
import com.github.dakusui.lisj.FormResult;
public class Matches extends BinomialPredicate {
/**
* Serial version UID.
*/
private static final long serialVersionUID = 7402316173263455615L;
@Override
protected Object checkParams(Object params) {
super.checkParams(params);
Utils.checknull(get(params, 0));
Utils.checknull(get(params, 1));
return params;
}
@Override
protected FormResult evaluateLast(Context context, Object[] evaluatedParams, FormResult lastResult) {
FormResult ret = lastResult;
String regex = evaluatedParams[1].toString();
String value = evaluatedParams[0].toString();
ret.value(value.matches(regex));
return ret;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy