This is an automated email from the ASF dual-hosted git repository.
zhangliang 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 f323f7b41ae Add more test cases on PrimaryKeyIngestPosition's impl
classes (#33354)
f323f7b41ae is described below
commit f323f7b41ae2f568addd14fd598ddcae157abb2c
Author: Liang Zhang <[email protected]>
AuthorDate: Wed Oct 23 00:12:32 2024 +0800
Add more test cases on PrimaryKeyIngestPosition's impl classes (#33354)
---
.../type/pk/type/IntegerPrimaryKeyIngestPositionTest.java | 8 --------
.../type/pk/type/StringPrimaryKeyIngestPositionTest.java | 15 ++-------------
.../type/pk/type/UnsupportedKeyIngestPositionTest.java | 9 ---------
3 files changed, 2 insertions(+), 30 deletions(-)
diff --git
a/kernel/data-pipeline/core/src/test/java/org/apache/shardingsphere/data/pipeline/core/ingest/position/type/pk/type/IntegerPrimaryKeyIngestPositionTest.java
b/kernel/data-pipeline/core/src/test/java/org/apache/shardingsphere/data/pipeline/core/ingest/position/type/pk/type/IntegerPrimaryKeyIngestPositionTest.java
index 9153d853bd2..a1896b319d5 100644
---
a/kernel/data-pipeline/core/src/test/java/org/apache/shardingsphere/data/pipeline/core/ingest/position/type/pk/type/IntegerPrimaryKeyIngestPositionTest.java
+++
b/kernel/data-pipeline/core/src/test/java/org/apache/shardingsphere/data/pipeline/core/ingest/position/type/pk/type/IntegerPrimaryKeyIngestPositionTest.java
@@ -17,7 +17,6 @@
package
org.apache.shardingsphere.data.pipeline.core.ingest.position.type.pk.type;
-import
org.apache.shardingsphere.data.pipeline.core.ingest.position.type.pk.PrimaryKeyIngestPositionFactory;
import org.junit.jupiter.api.Test;
import static org.hamcrest.CoreMatchers.is;
@@ -25,13 +24,6 @@ import static org.hamcrest.MatcherAssert.assertThat;
class IntegerPrimaryKeyIngestPositionTest {
- @Test
- void assertInit() {
- IntegerPrimaryKeyIngestPosition position =
(IntegerPrimaryKeyIngestPosition)
PrimaryKeyIngestPositionFactory.newInstance("i,1,100");
- assertThat(position.getBeginValue(), is(1L));
- assertThat(position.getEndValue(), is(100L));
- }
-
@Test
void assertToString() {
assertThat(new IntegerPrimaryKeyIngestPosition(1L, 100L).toString(),
is("i,1,100"));
diff --git
a/kernel/data-pipeline/core/src/test/java/org/apache/shardingsphere/data/pipeline/core/ingest/position/type/pk/type/StringPrimaryKeyIngestPositionTest.java
b/kernel/data-pipeline/core/src/test/java/org/apache/shardingsphere/data/pipeline/core/ingest/position/type/pk/type/StringPrimaryKeyIngestPositionTest.java
index 0b0a9a2dad1..8cea55acf3e 100644
---
a/kernel/data-pipeline/core/src/test/java/org/apache/shardingsphere/data/pipeline/core/ingest/position/type/pk/type/StringPrimaryKeyIngestPositionTest.java
+++
b/kernel/data-pipeline/core/src/test/java/org/apache/shardingsphere/data/pipeline/core/ingest/position/type/pk/type/StringPrimaryKeyIngestPositionTest.java
@@ -17,31 +17,20 @@
package
org.apache.shardingsphere.data.pipeline.core.ingest.position.type.pk.type;
-import
org.apache.shardingsphere.data.pipeline.core.ingest.position.type.pk.PrimaryKeyIngestPositionFactory;
import org.junit.jupiter.api.Test;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
-import static org.junit.jupiter.api.Assertions.assertNull;
class StringPrimaryKeyIngestPositionTest {
- @Test
- void assertInit() {
- StringPrimaryKeyIngestPosition position =
(StringPrimaryKeyIngestPosition)
PrimaryKeyIngestPositionFactory.newInstance("s,hi,jk");
- assertThat(position.getBeginValue(), is("hi"));
- assertThat(position.getEndValue(), is("jk"));
- }
-
@Test
void assertToString() {
assertThat(new StringPrimaryKeyIngestPosition("hi", "jk").toString(),
is("s,hi,jk"));
}
@Test
- void assertEmptyToNull() {
- StringPrimaryKeyIngestPosition actual =
(StringPrimaryKeyIngestPosition)
PrimaryKeyIngestPositionFactory.newInstance("s,,");
- assertNull(actual.getBeginValue());
- assertNull(actual.getEndValue());
+ void assertToStringWithNullValue() {
+ assertThat(new StringPrimaryKeyIngestPosition(null, null).toString(),
is("s,,"));
}
}
diff --git
a/kernel/data-pipeline/core/src/test/java/org/apache/shardingsphere/data/pipeline/core/ingest/position/type/pk/type/UnsupportedKeyIngestPositionTest.java
b/kernel/data-pipeline/core/src/test/java/org/apache/shardingsphere/data/pipeline/core/ingest/position/type/pk/type/UnsupportedKeyIngestPositionTest.java
index 657a77c206a..5bc5fc51afc 100644
---
a/kernel/data-pipeline/core/src/test/java/org/apache/shardingsphere/data/pipeline/core/ingest/position/type/pk/type/UnsupportedKeyIngestPositionTest.java
+++
b/kernel/data-pipeline/core/src/test/java/org/apache/shardingsphere/data/pipeline/core/ingest/position/type/pk/type/UnsupportedKeyIngestPositionTest.java
@@ -17,22 +17,13 @@
package
org.apache.shardingsphere.data.pipeline.core.ingest.position.type.pk.type;
-import
org.apache.shardingsphere.data.pipeline.core.ingest.position.type.pk.PrimaryKeyIngestPositionFactory;
import org.junit.jupiter.api.Test;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
-import static org.junit.jupiter.api.Assertions.assertNull;
class UnsupportedKeyIngestPositionTest {
- @Test
- void assertInit() {
- UnsupportedKeyIngestPosition position = (UnsupportedKeyIngestPosition)
PrimaryKeyIngestPositionFactory.newInstance("u,,");
- assertNull(position.getBeginValue());
- assertNull(position.getEndValue());
- }
-
@Test
void assertToString() {
assertThat(new UnsupportedKeyIngestPosition().toString(), is("u,,"));