Issue #3378: Fixed TreeWalkerTest to not depend on a specific ordering of non-deterministic APIs (#3389)
This commit is contained in:
parent
77081171f2
commit
bcbcf28fff
|
|
@ -31,6 +31,8 @@ import java.nio.charset.StandardCharsets;
|
|||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
|
|
@ -93,10 +95,14 @@ public class TreeWalkerTest extends BaseCheckTestSupport {
|
|||
}
|
||||
catch (CheckstyleException ex) {
|
||||
final String errorMsg = ex.getMessage();
|
||||
assertTrue(errorMsg.contains("cannot initialize module"
|
||||
+ " com.puppycrawl.tools.checkstyle.TreeWalker - Token \"IMPORT\""
|
||||
+ " was not found in Acceptable tokens list in check"
|
||||
final Pattern expected = Pattern.compile(Pattern.quote("cannot initialize module"
|
||||
+ " com.puppycrawl.tools.checkstyle.TreeWalker - Token ")
|
||||
+ "\"(ENUM_DEF|CLASS_DEF|METHOD_DEF|IMPORT)\""
|
||||
+ Pattern.quote(" was not found in Acceptable tokens list in check"
|
||||
+ " com.puppycrawl.tools.checkstyle.checks.coding.HiddenFieldCheck"));
|
||||
|
||||
final Matcher errorMsgMatcher = expected.matcher(errorMsg);
|
||||
assertTrue("Failure for: " + errorMsg, errorMsgMatcher.matches());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue