Repository: apache/shardingsphere
Issue: When use ShardingQueryAssistedEncryptor to find assistedQueryColumns, an outOfIndex exception will occur.

Here is the point:
```
ShardingEncryptorStrategy

/**
     * Get assisted query column.
     *
     * @param logicTableName logic table name
     * @param columnName column name
     * @return assisted query column
     */
    public Optional<String> getAssistedQueryColumn(final String logicTableName, final String columnName) {
        for (ColumnNode each : columns) {
            ColumnNode target = new ColumnNode(logicTableName, columnName);
            if (each.equals(target)) {
                return Optional.of(assistedQueryColumns.get(columns.indexOf(target)).getColumnName());
            }
        }
        return Optional.absent();
    }
```

Changed files:
sharding-core/sharding-core-common/src/test/java/org/apache/shardingsphere/core/strategy/encrypt/ShardingEncryptorStrategyTest.java
sharding-core/sharding-core-common/src/main/java/org/apache/shardingsphere/core/strategy/encrypt/ShardingEncryptorStrategy.java

diff --git a/sharding-core/sharding-core-common/src/main/java/org/apache/shardingsphere/core/strategy/encrypt/ShardingEncryptorStrategy.java b/sharding-core/sharding-core-common/src/main/java/org/apache/shardingsphere/core/strategy/encrypt/ShardingEncryptorStrategy.java
index f06942e5886..e7a97f0bb70 100644
--- a/sharding-core/sharding-core-common/src/main/java/org/apache/shardingsphere/core/strategy/encrypt/ShardingEncryptorStrategy.java
+++ b/sharding-core/sharding-core-common/src/main/java/org/apache/shardingsphere/core/strategy/encrypt/ShardingEncryptorStrategy.java
@@ -17,7 +17,6 @@
 
 package org.apache.shardingsphere.core.strategy.encrypt;
 
-import com.google.common.base.Function;
 import com.google.common.base.Optional;
 import com.google.common.base.Preconditions;
 import com.google.common.base.Predicate;
@@ -32,6 +31,7 @@ import org.apache.shardingsphere.spi.encrypt.ShardingQueryAssistedEncryptor;
 
 import java.util.Collection;
 import java.util.Collections;
+import java.util.LinkedHashSet;
 import java.util.LinkedList;
 import java.util.List;
 
@@ -105,6 +105,9 @@ public final class ShardingEncryptorStrategy {
      * @return assisted query column
      */
     public Optional<String> getAssistedQueryColumn(final String logicTableName, final String columnName) {
+        if (assistedQueryColumns.isEmpty()) {
+            return Optional.absent();
+        }
         for (ColumnNode each : columns) {
             ColumnNode target = new ColumnNode(logicTableName, columnName);
             if (each.equals(target)) {
@@ -145,12 +148,10 @@ public final class ShardingEncryptorStrategy {
      * @return encrypt table names
      */
     public Collection<String> getEncryptTableNames() {
-        return Collections2.transform(columns, new Function<ColumnNode, String>() {
-            
-            @Override
-            public String apply(final ColumnNode input) {
-                return input.getTableName();
-            }
-        });
+        Collection<String> result = new LinkedHashSet<>();
+        for (ColumnNode each : columns) {
+            result.add(each.getTableName());
+        }
+        return result;
     }
 }
diff --git a/sharding-core/sharding-core-common/src/test/java/org/apache/shardingsphere/core/strategy/encrypt/ShardingEncryptorStrategyTest.java b/sharding-core/sharding-core-common/src/test/java/org/apache/shardingsphere/core/strategy/encrypt/ShardingEncryptorStrategyTest.java
index 1e89575a0b2..42d8f8f0f36 100644
--- a/sharding-core/sharding-core-common/src/test/java/org/apache/shardingsphere/core/strategy/encrypt/ShardingEncryptorStrategyTest.java
+++ b/sharding-core/sharding-core-common/src/test/java/org/apache/shardingsphere/core/strategy/encrypt/ShardingEncryptorStrategyTest.java
@@ -27,6 +27,7 @@ import java.util.Properties;
 import static org.hamcrest.CoreMatchers.instanceOf;
 import static org.hamcrest.CoreMatchers.is;
 import static org.junit.Assert.assertThat;
+import static org.junit.Assert.assertTrue;
 
 public final class ShardingEncryptorStrategyTest {
     
@@ -39,14 +40,51 @@ public final class ShardingEncryptorStrategyTest {
     
     @Test(expected = IllegalArgumentException.class)
     public void assertInvalidConstructor() {
-        EncryptorRuleConfiguration encryptorRuleConfiguration = new EncryptorRuleConfiguration("test", "test.pwd1, test.pwd2", "test.pwd1_index", new Properties());
+        EncryptorRuleConfiguration encryptorRuleConfiguration = new EncryptorRuleConfiguration("assistedTest", "test.pwd1, test.pwd2", "test.pwd1_index", new Properties());
         new ShardingEncryptorStrategy(encryptorRuleConfiguration);
     }
     
     @Test
     public void assertGetAssistedQueryColumn() {
-        EncryptorRuleConfiguration encryptorRuleConfiguration = new EncryptorRuleConfiguration("test", "test.pwd1, test.pwd2", "test.pwd1_index,test.pwd2_index", new Properties());
+        EncryptorRuleConfiguration encryptorRuleConfiguration = new EncryptorRuleConfiguration("assistedTest", "test.pwd1, test.pwd2", "test.pwd1_index,test.pwd2_index", new Properties());
         ShardingEncryptorStrategy actual = new ShardingEncryptorStrategy(encryptorRuleConfiguration);
         assertThat(actual.getAssistedQueryColumn("test", "pwd1"), is(Optional.of("pwd1_index")));
+        assertThat(actual.getAssistedQueryColumn("test", "pwd3"), is(Optional.<String>absent()));
+    }
+    
+    @Test
+    public void assertGetAssistedQueryColumnWithoutResult() {
+        EncryptorRuleConfiguration encryptorRuleConfiguration = new EncryptorRuleConfiguration("test", "test.pwd1, test.pwd2", new Properties());
+        ShardingEncryptorStrategy actual = new ShardingEncryptorStrategy(encryptorRuleConfiguration);
+        assertThat(actual.getAssistedQueryColumn("test", "pwd1"), is(Optional.<String>absent()));
+    }
+    
+    @Test
+    public void assertGetAssistedQueryCount() {
+        EncryptorRuleConfiguration encryptorRuleConfiguration = new EncryptorRuleConfiguration("assistedTest", "test.pwd1, test.pwd2", "test.pwd1_index,test.pwd2_index", new Properties());
+        ShardingEncryptorStrategy actual = new ShardingEncryptorStrategy(encryptorRuleConfiguration);
+        assertThat(actual.getAssistedQueryColumnCount("test"), is(2));
+    }
+    
+    @Test
+    public void assertGetAssistedQueryColumnCountWithoutResult() {
+        EncryptorRuleConfiguration encryptorRuleConfiguration = new EncryptorRuleConfiguration("test", "test.pwd1, test.pwd2", new Properties());
+        ShardingEncryptorStrategy actual = new ShardingEncryptorStrategy(encryptorRuleConfiguration);
+        assertThat(actual.getAssistedQueryColumnCount("test"), is(0));
+        assertThat(actual.getAssistedQueryColumnCount("test1"), is(0));
+    }
+    
+    @Test
+    public void assertGetEncryptTableNames() {
+        EncryptorRuleConfiguration encryptorRuleConfiguration = new EncryptorRuleConfiguration("assistedTest", "test.pwd1, test.pwd2", "test.pwd1_index,test.pwd2_index", new Properties());
+        ShardingEncryptorStrategy actual = new ShardingEncryptorStrategy(encryptorRuleConfiguration);
+        assertThat(actual.getEncryptTableNames().size(), is(1));
+    }
+    
+    @Test
+    public void assertIsHasShardingQueryAssistedEncryptor() {
+        EncryptorRuleConfiguration encryptorRuleConfiguration = new EncryptorRuleConfiguration("assistedTest", "test.pwd1, test.pwd2", "test.pwd1_index,test.pwd2_index", new Properties());
+        ShardingEncryptorStrategy actual = new ShardingEncryptorStrategy(encryptorRuleConfiguration);
+        assertTrue(actual.isHasShardingQueryAssistedEncryptor("test"));
     }
 }