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

panjuan 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 7c76b52c226 Simplify ColumnSegmentTest (#19384)
7c76b52c226 is described below

commit 7c76b52c2268e663dc83d9e56e939d98aafc97c1
Author: Liang Zhang <[email protected]>
AuthorDate: Wed Jul 20 12:28:25 2022 +0800

    Simplify ColumnSegmentTest (#19384)
---
 .../common/segment/dml/column/ColumnSegment.java   |  8 ++----
 .../segment/dml/column/ColumnSegmentTest.java      | 32 +++-------------------
 2 files changed, 6 insertions(+), 34 deletions(-)

diff --git 
a/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/common/segment/dml/column/ColumnSegment.java
 
b/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/common/segment/dml/column/ColumnSegment.java
index bac7b8b0c23..55542ca5d69 100644
--- 
a/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/common/segment/dml/column/ColumnSegment.java
+++ 
b/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/common/segment/dml/column/ColumnSegment.java
@@ -52,9 +52,7 @@ public final class ColumnSegment implements 
ExpressionSegment, OwnerAvailable {
      * @return qualified name with quote characters
      */
     public String getQualifiedName() {
-        return null == owner
-                ? identifier.getValueWithQuoteCharacters()
-                : String.join(".", 
owner.getIdentifier().getValueWithQuoteCharacters(), 
identifier.getValueWithQuoteCharacters());
+        return null == owner ? identifier.getValueWithQuoteCharacters() : 
String.join(".", owner.getIdentifier().getValueWithQuoteCharacters(), 
identifier.getValueWithQuoteCharacters());
     }
     
     /**
@@ -63,9 +61,7 @@ public final class ColumnSegment implements 
ExpressionSegment, OwnerAvailable {
      * @return expression
      */
     public String getExpression() {
-        return null == owner
-                ? identifier.getValue()
-                : String.join(".", owner.getIdentifier().getValue(), 
identifier.getValue());
+        return null == owner ? identifier.getValue() : String.join(".", 
owner.getIdentifier().getValue(), identifier.getValue());
     }
     
     @Override
diff --git 
a/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/test/java/org/apache/shardingsphere/sql/parser/sql/common/segment/dml/column/ColumnSegmentTest.java
 
b/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/test/java/org/apache/shardingsphere/sql/parser/sql/common/segment/dml/column/ColumnSegmentTest.java
index a44f49eb8ad..9436c6cb629 100644
--- 
a/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/test/java/org/apache/shardingsphere/sql/parser/sql/common/segment/dml/column/ColumnSegmentTest.java
+++ 
b/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/test/java/org/apache/shardingsphere/sql/parser/sql/common/segment/dml/column/ColumnSegmentTest.java
@@ -28,14 +28,7 @@ public final class ColumnSegmentTest {
     
     @Test
     public void assertGetQualifiedNameWithoutOwner() {
-        ColumnSegment actual = new ColumnSegment(0, 0, new 
IdentifierValue("col"));
-        assertThat(actual.getQualifiedName(), is("col"));
-    }
-    
-    @Test
-    public void assertGetQualifiedNameWithoutOwner2() {
-        ColumnSegment actual = new ColumnSegment(0, 0, new 
IdentifierValue("`col`"));
-        assertThat(actual.getQualifiedName(), is("`col`"));
+        assertThat(new ColumnSegment(0, 0, new 
IdentifierValue("col")).getQualifiedName(), is("col"));
     }
     
     @Test
@@ -46,30 +39,13 @@ public final class ColumnSegmentTest {
     }
     
     @Test
-    public void assertGetQualifiedNameWithOwner2() {
-        ColumnSegment actual = new ColumnSegment(0, 0, new 
IdentifierValue("`col`"));
-        actual.setOwner(new OwnerSegment(0, 0, new IdentifierValue("tbl")));
-        assertThat(actual.getQualifiedName(), is("tbl.`col`"));
+    public void assertGetExpressionWithoutOwner() {
+        assertThat(new ColumnSegment(0, 0, new 
IdentifierValue("`col`")).getExpression(), is("col"));
     }
     
     @Test
-    public void assertGetQualifiedNameWithOwner3() {
-        ColumnSegment actual = new ColumnSegment(0, 0, new 
IdentifierValue("col"));
-        actual.setOwner(new OwnerSegment(0, 0, new IdentifierValue("`tbl`")));
-        assertThat(actual.getQualifiedName(), is("`tbl`.col"));
-    }
-    
-    @Test
-    public void assertGetQualifiedNameWithOwner4() {
-        ColumnSegment actual = new ColumnSegment(0, 0, new 
IdentifierValue("`col`"));
-        actual.setOwner(new OwnerSegment(0, 0, new IdentifierValue("`tbl`")));
-        assertThat(actual.getQualifiedName(), is("`tbl`.`col`"));
-    }
-
-    @Test
-    public void assertGetExpression() {
+    public void assertGetExpressionWithOwner() {
         ColumnSegment actual = new ColumnSegment(0, 0, new 
IdentifierValue("`col`"));
-        assertThat(actual.getExpression(), is("col"));
         actual.setOwner(new OwnerSegment(0, 0, new IdentifierValue("`tbl`")));
         assertThat(actual.getExpression(), is("tbl.col"));
     }

Reply via email to