You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by "100paperkite (via GitHub)" <gi...@apache.org> on 2023/04/28 04:55:49 UTC

[GitHub] [shardingsphere] 100paperkite opened a new pull request, #25386: Add unit tests for ShardingSphereTable

100paperkite opened a new pull request, #25386:
URL: https://github.com/apache/shardingsphere/pull/25386

   Fixes #25361
   
   Changes proposed in this pull request:
     -
   
   ---
   
   Before committing this PR, I'm sure that I have checked the following options:
   - [x] My code follows the [code of conduct](https://shardingsphere.apache.org/community/en/involved/conduct/code/) of this project.
   - [x] I have self-reviewed the commit code.
   - [x] I have (or in comment I request) added corresponding labels for the pull request.
   - [x] I have passed maven check locally : `./mvnw clean install -B -T1C -Dmaven.javadoc.skip -Dmaven.jacoco.skip -e`.
   - [ ] I have made corresponding changes to the documentation.
   - [x] I have added corresponding unit tests for my changes.
   


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] strongduanmu merged pull request #25386: Add unit tests for ShardingSphereTable

Posted by "strongduanmu (via GitHub)" <gi...@apache.org>.
strongduanmu merged PR #25386:
URL: https://github.com/apache/shardingsphere/pull/25386


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] strongduanmu commented on a diff in pull request #25386: Add unit tests for ShardingSphereTable

Posted by "strongduanmu (via GitHub)" <gi...@apache.org>.
strongduanmu commented on code in PR #25386:
URL: https://github.com/apache/shardingsphere/pull/25386#discussion_r1180044125


##########
infra/common/src/test/java/org/apache/shardingsphere/infra/metadata/database/schema/model/ShardingSphereTableTest.java:
##########
@@ -0,0 +1,151 @@
+/*
+ * 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.infra.metadata.database.schema.model;
+
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import java.sql.Types;
+import java.util.Collections;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.*;
+import static org.junit.jupiter.api.Assertions.*;
+
+class ShardingSphereTableTest {
+    
+    private ShardingSphereTable shardingSphereTable;
+    
+    @BeforeEach
+    void setUp() {
+        shardingSphereTable = new ShardingSphereTable();
+    }
+    
+    @Test
+    void putColumn() {

Review Comment:
   Please rename test method to assertPutColumn.



-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] strongduanmu commented on pull request #25386: Add unit tests for ShardingSphereTable

Posted by "strongduanmu (via GitHub)" <gi...@apache.org>.
strongduanmu commented on PR #25386:
URL: https://github.com/apache/shardingsphere/pull/25386#issuecomment-1532278988

   @100paperkite Good job, merged.


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] strongduanmu commented on a diff in pull request #25386: Add unit tests for ShardingSphereTable

Posted by "strongduanmu (via GitHub)" <gi...@apache.org>.
strongduanmu commented on code in PR #25386:
URL: https://github.com/apache/shardingsphere/pull/25386#discussion_r1182111946


##########
infra/common/src/test/java/org/apache/shardingsphere/infra/metadata/database/schema/model/ShardingSphereTableTest.java:
##########
@@ -0,0 +1,144 @@
+/*
+ * 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.infra.metadata.database.schema.model;
+
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import java.sql.Types;
+import java.util.Collections;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.is;
+import static org.hamcrest.Matchers.hasSize;
+import static org.hamcrest.Matchers.hasItems;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertNull;
+
+class ShardingSphereTableTest {
+    
+    private ShardingSphereTable shardingSphereTable;
+    
+    @BeforeEach
+    void setUp() {
+        shardingSphereTable = new ShardingSphereTable();
+    }
+    
+    @Test
+    void assertPutColumn() {
+        ShardingSphereColumn column1 = new ShardingSphereColumn("foo_column_1", Types.INTEGER, true, true, false, true, false);
+        ShardingSphereColumn column2 = new ShardingSphereColumn("foo_column_2", Types.INTEGER, false, true, false, true, false);
+        shardingSphereTable.putColumn(column1);
+        shardingSphereTable.putColumn(column2);
+        assertThat(shardingSphereTable.getColumn("foo_column_1"), is(column1));
+        assertThat(shardingSphereTable.getColumn("foo_column_2"), is(column2));
+        assertThat(shardingSphereTable.getColumns(), hasSize(2));
+    }
+    
+    @Test
+    void assertGetColumn() {
+        ShardingSphereColumn column = new ShardingSphereColumn("foo_column", Types.INTEGER, true, true, false, true, false);
+        shardingSphereTable.putColumn(column);
+        assertThat(shardingSphereTable.getColumn("foo_column"), is(column));
+        assertThat(shardingSphereTable.getColumn("FOO_COLUMN"), is(column));
+        assertNull(shardingSphereTable.getColumn("invalid"));
+    }
+    
+    @Test
+    void assertGetColumns() {
+        ShardingSphereColumn column1 = new ShardingSphereColumn("foo_column_1", Types.INTEGER, true, true, false, true, false);
+        ShardingSphereColumn column2 = new ShardingSphereColumn("foo_column_2", Types.INTEGER, false, true, false, true, false);
+        shardingSphereTable.putColumn(column1);
+        shardingSphereTable.putColumn(column2);
+        assertThat(shardingSphereTable.getColumns(), hasItems(column1, column2));
+        assertThat(shardingSphereTable.getColumns(), hasSize(2));
+    }
+    
+    @Test
+    void assertContainsColumn() {
+        ShardingSphereColumn column = new ShardingSphereColumn("foo_column", Types.INTEGER, true, true, false, true, false);
+        shardingSphereTable.putColumn(column);
+        assertTrue(shardingSphereTable.containsColumn("foo_column"));
+        assertFalse(shardingSphereTable.containsColumn("invalid"));
+    }
+    
+    @Test
+    void assertPutIndex() {
+        ShardingSphereIndex index1 = new ShardingSphereIndex("foo_index_1");
+        ShardingSphereIndex index2 = new ShardingSphereIndex("foo_index_2");
+        shardingSphereTable.putIndex(index1);
+        shardingSphereTable.putIndex(index2);
+        assertThat(shardingSphereTable.getIndex("foo_index_1"), is(index1));
+        assertThat(shardingSphereTable.getIndex("foo_index_2"), is(index2));
+        assertNull(shardingSphereTable.getIndex("invalid"));
+        assertThat(shardingSphereTable.getIndexes(), hasSize(2));
+    }
+    
+    @Test
+    void assertGetIndex() {
+        ShardingSphereIndex index = new ShardingSphereIndex("foo_index");
+        shardingSphereTable.putIndex(index);
+        assertThat(shardingSphereTable.getIndex("foo_index"), is(index));
+        assertThat(shardingSphereTable.getIndex("FOO_INDEX"), is(index));
+        assertNull(shardingSphereTable.getIndex("invalid"));
+    }
+    
+    @Test
+    void assertRemoveIndex() {
+        ShardingSphereIndex index1 = new ShardingSphereIndex("foo_index_1");
+        ShardingSphereIndex index2 = new ShardingSphereIndex("foo_index_2");
+        shardingSphereTable.putIndex(index1);
+        shardingSphereTable.putIndex(index2);
+        shardingSphereTable.removeIndex("foo_index_1");
+        assertNull(shardingSphereTable.getIndex("foo_index_1"));
+        shardingSphereTable.removeIndex("invalid");
+        assertThat(shardingSphereTable.getIndex("foo_index_2"), is(index2));
+        assertThat(shardingSphereTable.getIndexes(), hasSize(1));
+    }
+    
+    @Test
+    void assertGetIndexes() {
+        ShardingSphereIndex index1 = new ShardingSphereIndex("foo_index_1");
+        ShardingSphereIndex index2 = new ShardingSphereIndex("foo_index_2");
+        shardingSphereTable.putIndex(index1);
+        shardingSphereTable.putIndex(index2);
+        assertThat(shardingSphereTable.getIndexes(), hasItems(index1, index2));
+        assertThat(shardingSphereTable.getIndexes(), hasSize(2));
+    }
+    
+    @Test
+    void assertContainsIndex() {
+        ShardingSphereIndex index1 = new ShardingSphereIndex("foo_index_1");
+        ShardingSphereIndex index2 = new ShardingSphereIndex("foo_index_2");
+        shardingSphereTable.putIndex(index1);
+        shardingSphereTable.putIndex(index2);
+        

Review Comment:
   Please remove useless blank line.



-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] strongduanmu commented on a diff in pull request #25386: Add unit tests for ShardingSphereTable

Posted by "strongduanmu (via GitHub)" <gi...@apache.org>.
strongduanmu commented on code in PR #25386:
URL: https://github.com/apache/shardingsphere/pull/25386#discussion_r1180042652


##########
infra/common/src/test/java/org/apache/shardingsphere/infra/metadata/database/schema/model/ShardingSphereTableTest.java:
##########
@@ -0,0 +1,151 @@
+/*
+ * 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.infra.metadata.database.schema.model;
+
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import java.sql.Types;
+import java.util.Collections;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.*;
+import static org.junit.jupiter.api.Assertions.*;
+
+class ShardingSphereTableTest {
+    
+    private ShardingSphereTable shardingSphereTable;
+    
+    @BeforeEach
+    void setUp() {
+        shardingSphereTable = new ShardingSphereTable();
+    }
+    
+    @Test
+    void putColumn() {
+        ShardingSphereColumn column1 = new ShardingSphereColumn("foo_column_1", Types.INTEGER, true, true, false, true, false);
+        ShardingSphereColumn column2 = new ShardingSphereColumn("foo_column_2", Types.INTEGER, false, true, false, true, false);
+        shardingSphereTable.putColumn(column1);
+        shardingSphereTable.putColumn(column2);
+        

Review Comment:
   Please remove useless blank line.



##########
infra/common/src/test/java/org/apache/shardingsphere/infra/metadata/database/schema/model/ShardingSphereTableTest.java:
##########
@@ -0,0 +1,151 @@
+/*
+ * 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.infra.metadata.database.schema.model;
+
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import java.sql.Types;
+import java.util.Collections;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.*;
+import static org.junit.jupiter.api.Assertions.*;
+
+class ShardingSphereTableTest {
+    
+    private ShardingSphereTable shardingSphereTable;
+    
+    @BeforeEach
+    void setUp() {
+        shardingSphereTable = new ShardingSphereTable();
+    }
+    
+    @Test
+    void putColumn() {
+        ShardingSphereColumn column1 = new ShardingSphereColumn("foo_column_1", Types.INTEGER, true, true, false, true, false);
+        ShardingSphereColumn column2 = new ShardingSphereColumn("foo_column_2", Types.INTEGER, false, true, false, true, false);
+        shardingSphereTable.putColumn(column1);
+        shardingSphereTable.putColumn(column2);
+        
+        assertThat(shardingSphereTable.getColumn("foo_column_1"), is(column1));
+        assertThat(shardingSphereTable.getColumn("foo_column_2"), is(column2));
+        assertThat(shardingSphereTable.getColumns(), hasSize(2));
+    }
+    
+    @Test
+    void getColumn() {
+        ShardingSphereColumn column = new ShardingSphereColumn("foo_column", Types.INTEGER, true, true, false, true, false);
+        shardingSphereTable.putColumn(column);
+        
+        assertThat(shardingSphereTable.getColumn("foo_column"), is(column));
+        assertThat(shardingSphereTable.getColumn("FOO_COLUMN"), is(column));
+        assertNull(shardingSphereTable.getColumn("invalid"));
+    }
+    
+    @Test
+    void getColumns() {
+        ShardingSphereColumn column1 = new ShardingSphereColumn("foo_column_1", Types.INTEGER, true, true, false, true, false);
+        ShardingSphereColumn column2 = new ShardingSphereColumn("foo_column_2", Types.INTEGER, false, true, false, true, false);
+        
+        shardingSphereTable.putColumn(column1);
+        shardingSphereTable.putColumn(column2);
+        

Review Comment:
   Please remove useless blank line.



##########
infra/common/src/test/java/org/apache/shardingsphere/infra/metadata/database/schema/model/ShardingSphereTableTest.java:
##########
@@ -0,0 +1,151 @@
+/*
+ * 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.infra.metadata.database.schema.model;
+
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import java.sql.Types;
+import java.util.Collections;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.*;
+import static org.junit.jupiter.api.Assertions.*;
+
+class ShardingSphereTableTest {
+    
+    private ShardingSphereTable shardingSphereTable;
+    
+    @BeforeEach
+    void setUp() {
+        shardingSphereTable = new ShardingSphereTable();
+    }
+    
+    @Test
+    void putColumn() {
+        ShardingSphereColumn column1 = new ShardingSphereColumn("foo_column_1", Types.INTEGER, true, true, false, true, false);
+        ShardingSphereColumn column2 = new ShardingSphereColumn("foo_column_2", Types.INTEGER, false, true, false, true, false);
+        shardingSphereTable.putColumn(column1);
+        shardingSphereTable.putColumn(column2);
+        
+        assertThat(shardingSphereTable.getColumn("foo_column_1"), is(column1));
+        assertThat(shardingSphereTable.getColumn("foo_column_2"), is(column2));
+        assertThat(shardingSphereTable.getColumns(), hasSize(2));
+    }
+    
+    @Test
+    void getColumn() {
+        ShardingSphereColumn column = new ShardingSphereColumn("foo_column", Types.INTEGER, true, true, false, true, false);
+        shardingSphereTable.putColumn(column);
+        

Review Comment:
   Please remove useless blank line.



##########
infra/common/src/test/java/org/apache/shardingsphere/infra/metadata/database/schema/model/ShardingSphereTableTest.java:
##########
@@ -0,0 +1,151 @@
+/*
+ * 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.infra.metadata.database.schema.model;
+
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import java.sql.Types;
+import java.util.Collections;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.*;
+import static org.junit.jupiter.api.Assertions.*;
+
+class ShardingSphereTableTest {
+    
+    private ShardingSphereTable shardingSphereTable;
+    
+    @BeforeEach
+    void setUp() {
+        shardingSphereTable = new ShardingSphereTable();
+    }
+    
+    @Test
+    void putColumn() {
+        ShardingSphereColumn column1 = new ShardingSphereColumn("foo_column_1", Types.INTEGER, true, true, false, true, false);
+        ShardingSphereColumn column2 = new ShardingSphereColumn("foo_column_2", Types.INTEGER, false, true, false, true, false);
+        shardingSphereTable.putColumn(column1);
+        shardingSphereTable.putColumn(column2);
+        
+        assertThat(shardingSphereTable.getColumn("foo_column_1"), is(column1));
+        assertThat(shardingSphereTable.getColumn("foo_column_2"), is(column2));
+        assertThat(shardingSphereTable.getColumns(), hasSize(2));
+    }
+    
+    @Test
+    void getColumn() {
+        ShardingSphereColumn column = new ShardingSphereColumn("foo_column", Types.INTEGER, true, true, false, true, false);
+        shardingSphereTable.putColumn(column);
+        
+        assertThat(shardingSphereTable.getColumn("foo_column"), is(column));
+        assertThat(shardingSphereTable.getColumn("FOO_COLUMN"), is(column));
+        assertNull(shardingSphereTable.getColumn("invalid"));
+    }
+    
+    @Test
+    void getColumns() {
+        ShardingSphereColumn column1 = new ShardingSphereColumn("foo_column_1", Types.INTEGER, true, true, false, true, false);
+        ShardingSphereColumn column2 = new ShardingSphereColumn("foo_column_2", Types.INTEGER, false, true, false, true, false);
+        

Review Comment:
   Please remove useless blank line.



-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] 100paperkite commented on a diff in pull request #25386: Add unit tests for ShardingSphereTable

Posted by "100paperkite (via GitHub)" <gi...@apache.org>.
100paperkite commented on code in PR #25386:
URL: https://github.com/apache/shardingsphere/pull/25386#discussion_r1182113961


##########
infra/common/src/test/java/org/apache/shardingsphere/infra/metadata/database/schema/model/ShardingSphereTableTest.java:
##########
@@ -0,0 +1,144 @@
+/*
+ * 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.infra.metadata.database.schema.model;
+
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import java.sql.Types;
+import java.util.Collections;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.is;
+import static org.hamcrest.Matchers.hasSize;
+import static org.hamcrest.Matchers.hasItems;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertNull;
+
+class ShardingSphereTableTest {
+    
+    private ShardingSphereTable shardingSphereTable;
+    
+    @BeforeEach
+    void setUp() {
+        shardingSphereTable = new ShardingSphereTable();
+    }
+    
+    @Test
+    void assertPutColumn() {
+        ShardingSphereColumn column1 = new ShardingSphereColumn("foo_column_1", Types.INTEGER, true, true, false, true, false);
+        ShardingSphereColumn column2 = new ShardingSphereColumn("foo_column_2", Types.INTEGER, false, true, false, true, false);
+        shardingSphereTable.putColumn(column1);
+        shardingSphereTable.putColumn(column2);
+        assertThat(shardingSphereTable.getColumn("foo_column_1"), is(column1));
+        assertThat(shardingSphereTable.getColumn("foo_column_2"), is(column2));
+        assertThat(shardingSphereTable.getColumns(), hasSize(2));
+    }
+    
+    @Test
+    void assertGetColumn() {
+        ShardingSphereColumn column = new ShardingSphereColumn("foo_column", Types.INTEGER, true, true, false, true, false);
+        shardingSphereTable.putColumn(column);
+        assertThat(shardingSphereTable.getColumn("foo_column"), is(column));
+        assertThat(shardingSphereTable.getColumn("FOO_COLUMN"), is(column));
+        assertNull(shardingSphereTable.getColumn("invalid"));
+    }
+    
+    @Test
+    void assertGetColumns() {
+        ShardingSphereColumn column1 = new ShardingSphereColumn("foo_column_1", Types.INTEGER, true, true, false, true, false);
+        ShardingSphereColumn column2 = new ShardingSphereColumn("foo_column_2", Types.INTEGER, false, true, false, true, false);
+        shardingSphereTable.putColumn(column1);
+        shardingSphereTable.putColumn(column2);
+        assertThat(shardingSphereTable.getColumns(), hasItems(column1, column2));
+        assertThat(shardingSphereTable.getColumns(), hasSize(2));
+    }
+    
+    @Test
+    void assertContainsColumn() {
+        ShardingSphereColumn column = new ShardingSphereColumn("foo_column", Types.INTEGER, true, true, false, true, false);
+        shardingSphereTable.putColumn(column);
+        assertTrue(shardingSphereTable.containsColumn("foo_column"));
+        assertFalse(shardingSphereTable.containsColumn("invalid"));
+    }
+    
+    @Test
+    void assertPutIndex() {
+        ShardingSphereIndex index1 = new ShardingSphereIndex("foo_index_1");
+        ShardingSphereIndex index2 = new ShardingSphereIndex("foo_index_2");
+        shardingSphereTable.putIndex(index1);
+        shardingSphereTable.putIndex(index2);
+        assertThat(shardingSphereTable.getIndex("foo_index_1"), is(index1));
+        assertThat(shardingSphereTable.getIndex("foo_index_2"), is(index2));
+        assertNull(shardingSphereTable.getIndex("invalid"));
+        assertThat(shardingSphereTable.getIndexes(), hasSize(2));
+    }
+    
+    @Test
+    void assertGetIndex() {
+        ShardingSphereIndex index = new ShardingSphereIndex("foo_index");
+        shardingSphereTable.putIndex(index);
+        assertThat(shardingSphereTable.getIndex("foo_index"), is(index));
+        assertThat(shardingSphereTable.getIndex("FOO_INDEX"), is(index));
+        assertNull(shardingSphereTable.getIndex("invalid"));
+    }
+    
+    @Test
+    void assertRemoveIndex() {
+        ShardingSphereIndex index1 = new ShardingSphereIndex("foo_index_1");
+        ShardingSphereIndex index2 = new ShardingSphereIndex("foo_index_2");
+        shardingSphereTable.putIndex(index1);
+        shardingSphereTable.putIndex(index2);
+        shardingSphereTable.removeIndex("foo_index_1");
+        assertNull(shardingSphereTable.getIndex("foo_index_1"));
+        shardingSphereTable.removeIndex("invalid");
+        assertThat(shardingSphereTable.getIndex("foo_index_2"), is(index2));
+        assertThat(shardingSphereTable.getIndexes(), hasSize(1));
+    }
+    
+    @Test
+    void assertGetIndexes() {
+        ShardingSphereIndex index1 = new ShardingSphereIndex("foo_index_1");
+        ShardingSphereIndex index2 = new ShardingSphereIndex("foo_index_2");
+        shardingSphereTable.putIndex(index1);
+        shardingSphereTable.putIndex(index2);
+        assertThat(shardingSphereTable.getIndexes(), hasItems(index1, index2));
+        assertThat(shardingSphereTable.getIndexes(), hasSize(2));
+    }
+    
+    @Test
+    void assertContainsIndex() {
+        ShardingSphereIndex index1 = new ShardingSphereIndex("foo_index_1");
+        ShardingSphereIndex index2 = new ShardingSphereIndex("foo_index_2");
+        shardingSphereTable.putIndex(index1);
+        shardingSphereTable.putIndex(index2);
+        

Review Comment:
   Sorry for missing that. I removed it :)



-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org