This is an automated email from the ASF dual-hosted git repository.
duanzhengqiang 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 a4434c1 test file added for Order By Token (#16170)
a4434c1 is described below
commit a4434c135c1dd779bfb0fb5540098700bd17f127
Author: Shreya Ghosh <[email protected]>
AuthorDate: Fri Mar 18 10:09:49 2022 +0530
test file added for Order By Token (#16170)
* test file added for Order By Token
* Assertions Updated
* Removed Mock
* Changes Made
---
.../rewrite/token/pojo/OrderByTokenTest.java | 48 ++++++++++++++++++++++
1 file changed, 48 insertions(+)
diff --git
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/rewrite/token/pojo/OrderByTokenTest.java
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/rewrite/token/pojo/OrderByTokenTest.java
new file mode 100644
index 0000000..377aa36
--- /dev/null
+++
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/rewrite/token/pojo/OrderByTokenTest.java
@@ -0,0 +1,48 @@
+/*
+ * 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.sharding.rewrite.token.pojo;
+
+import org.apache.shardingsphere.sql.parser.sql.common.constant.OrderDirection;
+import org.junit.Before;
+import org.junit.Test;
+
+import java.util.List;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+public final class OrderByTokenTest {
+
+ private OrderByToken orderByToken;
+
+ @Before
+ public void setup() {
+ orderByToken = new OrderByToken(0);
+ List<String> columnLabels = orderByToken.getColumnLabels();
+ List<OrderDirection> orderDirections =
orderByToken.getOrderDirections();
+ columnLabels.add(0, "Test1");
+ columnLabels.add(1, "Test2");
+ orderDirections.add(0, OrderDirection.ASC);
+ orderDirections.add(1, OrderDirection.ASC);
+ }
+
+ @Test
+ public void assertToString() {
+ assertThat(orderByToken.toString(), is(" ORDER BY Test1 ASC,Test2 ASC
"));
+ }
+}