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 f6c587de713 Add test cases on InventoryTaskAckCallback (#33400)
f6c587de713 is described below

commit f6c587de7131e01389e4865f57f8905a6015750b
Author: Liang Zhang <[email protected]>
AuthorDate: Fri Oct 25 16:34:03 2024 +0800

    Add test cases on InventoryTaskAckCallback (#33400)
    
    * Add test cases on PipelineTaskUtils
    
    * Add test cases on InventoryTaskAckCallback
---
 .../core/task/InventoryTaskAckCallbackTest.java    | 40 ++++++++++++++++++++++
 1 file changed, 40 insertions(+)

diff --git 
a/kernel/data-pipeline/core/src/test/java/org/apache/shardingsphere/data/pipeline/core/task/InventoryTaskAckCallbackTest.java
 
b/kernel/data-pipeline/core/src/test/java/org/apache/shardingsphere/data/pipeline/core/task/InventoryTaskAckCallbackTest.java
new file mode 100644
index 00000000000..136d4ef2622
--- /dev/null
+++ 
b/kernel/data-pipeline/core/src/test/java/org/apache/shardingsphere/data/pipeline/core/task/InventoryTaskAckCallbackTest.java
@@ -0,0 +1,40 @@
+/*
+ * 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.data.pipeline.core.task;
+
+import 
org.apache.shardingsphere.data.pipeline.core.ingest.position.IngestPosition;
+import 
org.apache.shardingsphere.data.pipeline.core.ingest.record.FinishedRecord;
+import org.junit.jupiter.api.Test;
+
+import java.util.Collections;
+import java.util.concurrent.atomic.AtomicReference;
+
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+
+class InventoryTaskAckCallbackTest {
+    
+    @SuppressWarnings("unchecked")
+    @Test
+    void assertOnFailure() {
+        AtomicReference<IngestPosition> position = mock(AtomicReference.class);
+        IngestPosition newPosition = mock(IngestPosition.class);
+        new 
InventoryTaskAckCallback(position).onAck(Collections.singletonList(new 
FinishedRecord(newPosition)));
+        verify(position).set(newPosition);
+    }
+}

Reply via email to