Skip to content

The Unified and Autonomous Development Platform

midwork

robin shine84a6b124d00f
diff --git a/gitplex.product/src/test/java/gitplex/product/Test.java b/gitplex.product/src/test/java/gitplex/product/Test.java
index 0ac5709d34..00b2ec32b7 100644
--- a/gitplex.product/src/test/java/gitplex/product/Test.java
+++ b/gitplex.product/src/test/java/gitplex/product/Test.java
@@ -1,20 +1,37 @@
package gitplex.product;
-import org.antlr.v4.runtime.ANTLRInputStream;
-import org.antlr.v4.runtime.Token;
+import java.io.File;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.List;
-import com.pmease.gitplex.web.page.test.PostQueryLexer;
+import org.apache.commons.io.FileUtils;
+
+import com.pmease.commons.antlr.codeassist.CodeAssist;
+import com.pmease.commons.antlr.codeassist.InputSuggestion;
+import com.pmease.commons.antlr.codeassist.Node;
+import com.pmease.commons.antlr.codeassist.ParseTree;
+import com.pmease.commons.antlr.codeassist.SpecMatch;
+import com.pmease.commons.lang.extractors.java.JavaLexer;
public class Test {
@org.junit.Test
- public void test() {
- PostQueryLexer lexer = new PostQueryLexer(new ANTLRInputStream("hello world title:value"));
- Token token = lexer.nextToken();
- while (token.getType() != Token.EOF) {
- System.out.println(token);
- token = lexer.nextToken();
- }
+ public void test() throws IOException {
+ CodeAssist codeAssist = new CodeAssist(JavaLexer.class) {
+
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ protected List<InputSuggestion> suggest(ParseTree parseTree, Node elementNode, String matchWith) {
+ return null;
+ }
+
+ };
+
+ String content = FileUtils.readFileToString(new File("w:\\temp\\Test.java"));
+ SpecMatch match = codeAssist.getRule("blockStatement").match(codeAssist.lex(content), null, null, new HashMap<String, Integer>());
+ System.out.println(match.isMatched());
}
}
\ No newline at end of file