diff --git a/pom.xml b/pom.xml
index aa6965c5d48fbf1dec88f731e55ade73143062d6..fa36387ac21cef4e387458a86faf65227ffabc18 100644
--- a/pom.xml
+++ b/pom.xml
@@ -668,6 +668,7 @@
${maven-checkstyle-plugin.version}
src/resources/checkstyle_ci.xml
+ true
**/autogen/**/*
@@ -842,6 +843,7 @@
${maven-checkstyle-plugin.version}
src/resources/checkstyle.xml
+ true
**/autogen/**/*
diff --git a/sharding-core/sharding-core-common/src/main/java/org/apache/shardingsphere/core/rule/EncryptRule.java b/sharding-core/sharding-core-common/src/main/java/org/apache/shardingsphere/core/rule/EncryptRule.java
index 2da4a0d4dc645ccca23f19afdbdf44995c3d26b6..89e37d5598cbaf2acb259f49105fe9b25a76d99a 100644
--- a/sharding-core/sharding-core-common/src/main/java/org/apache/shardingsphere/core/rule/EncryptRule.java
+++ b/sharding-core/sharding-core-common/src/main/java/org/apache/shardingsphere/core/rule/EncryptRule.java
@@ -231,11 +231,7 @@ public final class EncryptRule implements BaseRule {
@Override
public Object apply(final Object input) {
- if (input == null) {
- return null;
- } else {
- return ((ShardingQueryAssistedEncryptor) shardingEncryptor.get()).queryAssistedEncrypt(input.toString());
- }
+ return null == input ? null : ((ShardingQueryAssistedEncryptor) shardingEncryptor.get()).queryAssistedEncrypt(input.toString());
}
});
}
@@ -255,11 +251,7 @@ public final class EncryptRule implements BaseRule {
@Override
public Object apply(final Object input) {
- if (input == null) {
- return null;
- } else {
- return String.valueOf(shardingEncryptor.get().encrypt(input.toString()));
- }
+ return null == input ? null : String.valueOf(shardingEncryptor.get().encrypt(input.toString()));
}
});
}
diff --git a/sharding-core/sharding-core-common/src/test/java/org/apache/shardingsphere/core/rule/EncryptRuleTest.java b/sharding-core/sharding-core-common/src/test/java/org/apache/shardingsphere/core/rule/EncryptRuleTest.java
index d9a7977706cf2944c662459fc72f116c64acfa0c..18905b06153473535ff9fc19b9a51db5a65dc326 100644
--- a/sharding-core/sharding-core-common/src/test/java/org/apache/shardingsphere/core/rule/EncryptRuleTest.java
+++ b/sharding-core/sharding-core-common/src/test/java/org/apache/shardingsphere/core/rule/EncryptRuleTest.java
@@ -30,43 +30,38 @@ import java.util.Properties;
import static org.junit.Assert.assertNull;
-/**
- * @author kezhenxu94
- */
-public class EncryptRuleTest {
+public final class EncryptRuleTest {
+
private final String table = "table";
+
private final String column = "column";
-
+
private EncryptRuleConfiguration encryptRuleConfig;
-
+
@Before
- public void before() {
+ public void setUp() {
Properties props = new Properties();
-
EncryptorRuleConfiguration encryptorConfig = new EncryptorRuleConfiguration("assistedTest", props);
EncryptColumnRuleConfiguration columnConfig = new EncryptColumnRuleConfiguration("plain_pwd", "cipher_pwd", "", "aes");
EncryptTableRuleConfiguration tableConfig = new EncryptTableRuleConfiguration(Collections.singletonMap(column, columnConfig));
-
encryptRuleConfig = new EncryptRuleConfiguration();
encryptRuleConfig.getEncryptors().put("aes", encryptorConfig);
encryptRuleConfig.getTables().put(table, tableConfig);
}
-
+
@Test
- public void testGetEncryptAssistedQueryValues() {
+ public void assertGetEncryptAssistedQueryValues() {
List