You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2022/04/01 02:41:33 UTC

[GitHub] [shardingsphere] yx9o commented on a change in pull request #16524: SchemaRulePersistService#isExisted need add unit test

yx9o commented on a change in pull request #16524:
URL: https://github.com/apache/shardingsphere/pull/16524#discussion_r840187959



##########
File path: shardingsphere-mode/shardingsphere-mode-core/src/test/java/org/apache/shardingsphere/mode/metadata/persist/service/impl/SchemaRulePersistServiceTest.java
##########
@@ -56,6 +56,15 @@ public void assertLoadWithExistedNode() {
         assertThat(actual.size(), is(1));
     }
     
+    @Test
+    public void assertIsExisted() {
+        when(repository.get("/metadata/foo_db/foo_db/active_version")).thenReturn("0");
+        when(repository.get("/metadata/foo_db/foo_db/versions/0/rules")).thenReturn(readYAML());
+        SchemaRulePersistService schemaRulePersistService = new SchemaRulePersistService(repository);
+        assertThat(schemaRulePersistService.isExisted("foo_db"), is(true));
+        assertThat(schemaRulePersistService.isExisted("foo_db_1"), is(false));

Review comment:
       Would it be more reasonable to use `assertTrue` and `assertFalse`.




-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org