This is an automated email from the ASF dual-hosted git repository.

wuweijie pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git


The following commit(s) were added to refs/heads/master by this push:
     new 6f5f2e9  Add test case for ParseASTNode (#10797)
6f5f2e9 is described below

commit 6f5f2e9fa1472138cb9b32dcb539dcbd4f5e4318
Author: Liang Zhang <[email protected]>
AuthorDate: Sat Jun 12 22:45:01 2021 +0800

    Add test case for ParseASTNode (#10797)
---
 .../sql/parser/core/ParseASTNodeTest.java          | 36 ++++++++++++++++++++++
 1 file changed, 36 insertions(+)

diff --git 
a/shardingsphere-sql-parser/shardingsphere-sql-parser-engine/src/test/java/org/apache/shardingsphere/sql/parser/core/ParseASTNodeTest.java
 
b/shardingsphere-sql-parser/shardingsphere-sql-parser-engine/src/test/java/org/apache/shardingsphere/sql/parser/core/ParseASTNodeTest.java
new file mode 100644
index 0000000..80aaadf
--- /dev/null
+++ 
b/shardingsphere-sql-parser/shardingsphere-sql-parser-engine/src/test/java/org/apache/shardingsphere/sql/parser/core/ParseASTNodeTest.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.sql.parser.core;
+
+import org.antlr.v4.runtime.tree.ParseTree;
+import org.junit.Test;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+public final class ParseASTNodeTest {
+    
+    @Test
+    public void assertGetRootNode() {
+        ParseTree parseTree = mock(ParseTree.class);
+        when(parseTree.getChild(0)).thenReturn(parseTree);
+        assertThat(new ParseASTNode(parseTree).getRootNode(), is(parseTree));
+    }
+}

Reply via email to