fitnesse.testsystems.slim.GlobComparator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of fitnesse Show documentation
Show all versions of fitnesse Show documentation
The fully integrated standalone wiki, and acceptance testing framework.
package fitnesse.testsystems.slim;
import java.util.regex.Pattern;
public class GlobComparator implements CustomComparator {
@Override
public boolean matches(String actual, String expected) {
return globToRegExp(expected).matcher(actual).matches();
}
private Pattern globToRegExp(String glob) {
return Pattern.compile("^\\Q" + glob.replace("*", "\\E.*\\Q").replace("?", "\\E.\\Q") + "\\E$", Pattern.DOTALL);
}
}