sandynz commented on code in PR #28842:
URL: https://github.com/apache/shardingsphere/pull/28842#discussion_r1368319508


##########
test/it/pipeline/src/test/java/org/apache/shardingsphere/test/it/data/pipeline/core/job/service/GovernanceRepositoryAPIImplTest.java:
##########
@@ -48,9 +48,7 @@
 import static org.hamcrest.CoreMatchers.anyOf;
 import static org.hamcrest.CoreMatchers.is;
 import static org.hamcrest.MatcherAssert.assertThat;
-import static org.junit.jupiter.api.Assertions.assertFalse;
-import static org.junit.jupiter.api.Assertions.assertNotNull;
-import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.*;

Review Comment:
   The importing could not be combined. Suggest to import ShardingSphere code 
style in IDEA, path: `src/resources/code-style-idea.xml`



##########
test/it/pipeline/src/test/java/org/apache/shardingsphere/test/it/data/pipeline/core/job/service/GovernanceRepositoryAPIImplTest.java:
##########
@@ -155,7 +153,39 @@ void assertPersistJobOffsetInfo() {
         assertTrue(actual.isPresent());
         assertThat(actual.get(), is("testValue"));
     }
-    
+
+    @Test
+    void assertPersistLatestCheckJobId() {
+        String parentJobId = "parentJob123";
+        String checkJobId = "checkJob456";
+        governanceRepositoryAPI.persistLatestCheckJobId(parentJobId, 
checkJobId);
+        Optional<String> retrievedCheckJobId = 
governanceRepositoryAPI.getLatestCheckJobId(parentJobId);
+        assertTrue(retrievedCheckJobId.isPresent(), "Expected a checkJobId to 
be present");
+        assertEquals(retrievedCheckJobId.get(), checkJobId, "The retrieved 
checkJobId does not match the persisted one");
+    }
+
+    @Test
+    void assertGetLatestCheckJobId() {
+        String parentJobId = "parentJob789";
+        String checkJobId = "checkJob012";
+        governanceRepositoryAPI.persistLatestCheckJobId(parentJobId, 
checkJobId);
+        Optional<String> retrievedCheckJobId = 
governanceRepositoryAPI.getLatestCheckJobId(parentJobId);
+        assertTrue(retrievedCheckJobId.isPresent(), "Expected a checkJobId to 
be present");
+        assertEquals(checkJobId, retrievedCheckJobId.get(), "The retrieved 
checkJobId does not match the expected one");
+        governanceRepositoryAPI.deleteLatestCheckJobId(parentJobId);
+        
assertFalse(governanceRepositoryAPI.getLatestCheckJobId(parentJobId).isPresent(),
 "Expected no checkJobId to be present after deletion");
+    }
+
+    @Test
+    void assertDeleteLatestCheckJobId() {
+        String parentJobId = "parentJob123";
+        String checkJobId = "checkJob456";
+        governanceRepositoryAPI.persistLatestCheckJobId(parentJobId, 
checkJobId);
+        
assertTrue(governanceRepositoryAPI.getLatestCheckJobId(parentJobId).isPresent(),
 "Expected checkJobId to be present before deletion");
+        governanceRepositoryAPI.deleteLatestCheckJobId(parentJobId);
+        
assertFalse(governanceRepositoryAPI.getLatestCheckJobId(parentJobId).isPresent(),
 "Expected no checkJobId to be present after deletion");
+    }

Review Comment:
   It's better to combine them in one unit test method, in order to reduce 
duplicated code.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to