Au-Miner commented on code in PR #28387:
URL: https://github.com/apache/flink/pull/28387#discussion_r3497759813


##########
flink-table/flink-sql-parser/src/test/java/org/apache/flink/sql/parser/FlinkSqlParserUnParserTest.java:
##########
@@ -0,0 +1,116 @@
+/*
+ * 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.flink.sql.parser;
+
+import org.apache.calcite.sql.parser.SqlParserFixture;
+import org.junit.jupiter.api.Nested;
+import org.junit.jupiter.api.parallel.Execution;
+
+import static org.junit.jupiter.api.parallel.ExecutionMode.CONCURRENT;
+
+/**
+ * Unparser (round-trip) tests for all Flink SQL parser syntax categories.
+ *
+ * <p>Each {@link Nested} inner class extends the corresponding parser test 
class and overrides
+ * {@link #fixture()} to use {@link SqlParserTest.UnparsingTesterImpl}, which 
verifies that parse
+ * &rarr; unparse &rarr; re-parse produces consistent results.
+ */
+@Execution(CONCURRENT)
+class FlinkSqlParserUnParserTest {
+
+    @Nested
+    class CatalogUnParserTest extends FlinkSqlParserCatalogTest {
+        @Override
+        public SqlParserFixture fixture() {
+            return super.fixture().withTester(new 
DeepCopyUnparsingTesterImpl());
+        }
+    }
+
+    @Nested
+    class MetadataUnParserTest extends FlinkSqlParserMetadataTest {
+        @Override
+        public SqlParserFixture fixture() {
+            return super.fixture().withTester(new 
DeepCopyUnparsingTesterImpl());
+        }
+    }
+
+    @Nested
+    class CreateTableUnParserTest extends FlinkSqlParserCreateTableTest {
+        @Override
+        public SqlParserFixture fixture() {
+            return super.fixture().withTester(new 
DeepCopyUnparsingTesterImpl());
+        }
+    }
+
+    @Nested
+    class AlterTableUnParserTest extends FlinkSqlParserAlterTableTest {
+        @Override
+        public SqlParserFixture fixture() {
+            return super.fixture().withTester(new 
DeepCopyUnparsingTesterImpl());
+        }
+    }
+
+    @Nested
+    class CtasUnParserTest extends FlinkSqlParserCtasTest {
+        @Override
+        public SqlParserFixture fixture() {
+            return super.fixture().withTester(new 
DeepCopyUnparsingTesterImpl());
+        }
+    }
+
+    @Nested
+    class ViewUnParserTest extends FlinkSqlParserViewTest {
+        @Override
+        public SqlParserFixture fixture() {
+            return super.fixture().withTester(new 
DeepCopyUnparsingTesterImpl());
+        }
+    }
+
+    @Nested
+    class ModelUnParserTest extends FlinkSqlParserModelTest {
+        @Override
+        public SqlParserFixture fixture() {
+            return super.fixture().withTester(new 
DeepCopyUnparsingTesterImpl());
+        }

Review Comment:
   With the monolithic FlinkSqlParserImplTest, a single subclass 
FlinkSqlUnParserTest extends FlinkSqlParserImplTest was enough. After splitting 
tests into separate classes, Java's single inheritance prevents one class from 
extending all of them. The @Nested subclass-per-category pattern is the 
standard JUnit 5 approach for running the same test suite with a different 
fixture.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to