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 09ae2db119e Fix test failed on
ConditionValueBetweenOperatorGeneratorTest (#25805)
09ae2db119e is described below
commit 09ae2db119e9ee5f57c71c1e4eadafba49e6e80e
Author: Liang Zhang <[email protected]>
AuthorDate: Sat May 20 15:53:02 2023 +0800
Fix test failed on ConditionValueBetweenOperatorGeneratorTest (#25805)
---
.../impl/ConditionValueBetweenOperatorGeneratorTest.java | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git
a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/route/engine/condition/generator/impl/ConditionValueBetweenOperatorGeneratorTest.java
b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/route/engine/condition/generator/impl/ConditionValueBetweenOperatorGeneratorTest.java
index d8867ac6e52..30697d82e36 100644
---
a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/route/engine/condition/generator/impl/ConditionValueBetweenOperatorGeneratorTest.java
+++
b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/route/engine/condition/generator/impl/ConditionValueBetweenOperatorGeneratorTest.java
@@ -35,6 +35,8 @@ import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.junit.jupiter.MockitoExtension;
+import java.sql.Timestamp;
+import java.time.LocalDateTime;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
@@ -106,8 +108,8 @@ class ConditionValueBetweenOperatorGeneratorTest {
@SuppressWarnings("unchecked")
@Test
void assertGenerateOneNowConditionValue() {
- Date date = new Date();
- ExpressionSegment betweenSegment = new LiteralExpressionSegment(0, 0,
date);
+ Timestamp timestamp = Timestamp.valueOf(LocalDateTime.now());
+ ExpressionSegment betweenSegment = new LiteralExpressionSegment(0, 0,
timestamp);
ExpressionSegment andSegment = new CommonExpressionSegment(0, 0,
"now()");
BetweenExpression value = new BetweenExpression(0, 0, null,
betweenSegment, andSegment, false);
Optional<ShardingConditionValue> shardingConditionValue =
generator.generate(value, column, new LinkedList<>(), timestampServiceRule);
@@ -115,7 +117,7 @@ class ConditionValueBetweenOperatorGeneratorTest {
RangeShardingConditionValue<Date> rangeShardingConditionValue =
(RangeShardingConditionValue<Date>) shardingConditionValue.get();
assertThat(rangeShardingConditionValue.getColumnName(),
is(column.getName()));
assertThat(rangeShardingConditionValue.getTableName(),
is(column.getTableName()));
-
assertThat(rangeShardingConditionValue.getValueRange().lowerEndpoint(),
is(date));
+
assertThat(rangeShardingConditionValue.getValueRange().lowerEndpoint(),
is(timestamp));
assertTrue(rangeShardingConditionValue.getParameterMarkerIndexes().isEmpty());
}