You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by pa...@apache.org on 2022/04/12 03:48:42 UTC

[shardingsphere] branch master updated: Refactor RuleAlteredDetectorFactoryTest (#16754)

This is an automated email from the ASF dual-hosted git repository.

panjuan 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 49075c81a76 Refactor RuleAlteredDetectorFactoryTest (#16754)
49075c81a76 is described below

commit 49075c81a7619406e016c6bfa84e4233f71d363d
Author: Liang Zhang <zh...@apache.org>
AuthorDate: Tue Apr 12 11:48:37 2022 +0800

    Refactor RuleAlteredDetectorFactoryTest (#16754)
---
 .../spi/rulealtered/RuleAlteredDetectorFactoryTest.java    | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-spi/src/test/java/org/apache/shardingsphere/data/pipeline/spi/rulealtered/RuleAlteredDetectorFactoryTest.java b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-spi/src/test/java/org/apache/shardingsphere/data/pipeline/spi/rulealtered/RuleAlteredDetectorFactoryTest.java
index 2e848dcba29..293efb4ad3b 100644
--- a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-spi/src/test/java/org/apache/shardingsphere/data/pipeline/spi/rulealtered/RuleAlteredDetectorFactoryTest.java
+++ b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-spi/src/test/java/org/apache/shardingsphere/data/pipeline/spi/rulealtered/RuleAlteredDetectorFactoryTest.java
@@ -20,22 +20,18 @@ package org.apache.shardingsphere.data.pipeline.spi.rulealtered;
 import org.apache.shardingsphere.infra.config.RuleConfiguration;
 import org.junit.Test;
 
-import java.util.Optional;
-
 import static org.junit.Assert.assertFalse;
+import static org.mockito.Mockito.mock;
 
 public final class RuleAlteredDetectorFactoryTest {
-
+    
     @Test
     public void assertNewInstanceWithRuleConfiguration() {
-        Optional<RuleAlteredDetector> ruleAlteredDetector = RuleAlteredDetectorFactory.newInstance(new RuleConfiguration() {
-        });
-        assertFalse(ruleAlteredDetector.isPresent());
+        assertFalse(RuleAlteredDetectorFactory.newInstance(mock(RuleConfiguration.class)).isPresent());
     }
-
+    
     @Test
     public void assertNewInstanceWithYamlRuleConfiguration() {
-        Optional<RuleAlteredDetector> ruleAlteredDetector = RuleAlteredDetectorFactory.newInstance(() -> null);
-        assertFalse(ruleAlteredDetector.isPresent());
+        assertFalse(RuleAlteredDetectorFactory.newInstance(mock(RuleConfiguration.class)).isPresent());
     }
 }