You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@atlas.apache.org by ma...@apache.org on 2017/09/19 03:26:32 UTC

atlas git commit: ATLAS-2146: Remove Powermock Usage

Repository: atlas
Updated Branches:
  refs/heads/master 2bcbd259e -> 1dee77afc


ATLAS-2146: Remove Powermock Usage

Signed-off-by: Madhan Neethiraj <ma...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/atlas/repo
Commit: http://git-wip-us.apache.org/repos/asf/atlas/commit/1dee77af
Tree: http://git-wip-us.apache.org/repos/asf/atlas/tree/1dee77af
Diff: http://git-wip-us.apache.org/repos/asf/atlas/diff/1dee77af

Branch: refs/heads/master
Commit: 1dee77afc5262755880d80e0c82c5fa9dce2f2ff
Parents: 2bcbd25
Author: Ashutosh Mestry <am...@apache.org>
Authored: Mon Sep 18 17:43:33 2017 -0700
Committer: Madhan Neethiraj <ma...@apache.org>
Committed: Mon Sep 18 17:43:33 2017 -0700

----------------------------------------------------------------------
 repository/pom.xml                              |   6 -
 .../atlas/discovery/EntityDiscoveryService.java |   4 +-
 .../atlas/repository/impexp/ExportService.java  |   4 +-
 .../impexp/TypeAttributeDifference.java         |  10 +-
 .../discovery/EntityDiscoveryServiceTest.java   | 125 ++++++++++++++++++
 .../repository/impexp/ExportServiceTest.java    |  22 +---
 .../impexp/TypeAttributeDifferenceTest.java     |   7 +-
 .../services/EntityDiscoveryServiceTest.java    | 129 -------------------
 8 files changed, 147 insertions(+), 160 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/atlas/blob/1dee77af/repository/pom.xml
----------------------------------------------------------------------
diff --git a/repository/pom.xml b/repository/pom.xml
index 8e8ccab..e005484 100755
--- a/repository/pom.xml
+++ b/repository/pom.xml
@@ -33,12 +33,6 @@
 
     <dependencies>
         <dependency>
-            <groupId>org.powermock</groupId>
-            <artifactId>powermock-reflect</artifactId>
-            <version>1.6.1</version>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
             <groupId>org.apache.atlas</groupId>
             <artifactId>atlas-intg</artifactId>
         </dependency>

http://git-wip-us.apache.org/repos/asf/atlas/blob/1dee77af/repository/src/main/java/org/apache/atlas/discovery/EntityDiscoveryService.java
----------------------------------------------------------------------
diff --git a/repository/src/main/java/org/apache/atlas/discovery/EntityDiscoveryService.java b/repository/src/main/java/org/apache/atlas/discovery/EntityDiscoveryService.java
index ad21ee4..14cb439 100644
--- a/repository/src/main/java/org/apache/atlas/discovery/EntityDiscoveryService.java
+++ b/repository/src/main/java/org/apache/atlas/discovery/EntityDiscoveryService.java
@@ -17,6 +17,7 @@
  */
 package org.apache.atlas.discovery;
 
+import com.google.common.annotations.VisibleForTesting;
 import org.apache.atlas.ApplicationProperties;
 import org.apache.atlas.AtlasConfiguration;
 import org.apache.atlas.AtlasErrorCode;
@@ -770,7 +771,8 @@ public class EntityDiscoveryService implements AtlasDiscoveryService {
         return "";
     }
 
-    private static String getTypeFilter(AtlasTypeRegistry typeRegistry, String typeName, int maxTypesLengthInIdxQuery) {
+    @VisibleForTesting
+    static String getTypeFilter(AtlasTypeRegistry typeRegistry, String typeName, int maxTypesLengthInIdxQuery) {
         AtlasEntityType type                  = typeRegistry.getEntityTypeByName(typeName);
         String          typeAndSubTypesQryStr = type != null ? type.getTypeAndAllSubTypesQryStr() : null;
 

http://git-wip-us.apache.org/repos/asf/atlas/blob/1dee77af/repository/src/main/java/org/apache/atlas/repository/impexp/ExportService.java
----------------------------------------------------------------------
diff --git a/repository/src/main/java/org/apache/atlas/repository/impexp/ExportService.java b/repository/src/main/java/org/apache/atlas/repository/impexp/ExportService.java
index de48573..a88c09e 100644
--- a/repository/src/main/java/org/apache/atlas/repository/impexp/ExportService.java
+++ b/repository/src/main/java/org/apache/atlas/repository/impexp/ExportService.java
@@ -17,6 +17,7 @@
  */
 package org.apache.atlas.repository.impexp;
 
+import com.google.common.annotations.VisibleForTesting;
 import org.apache.atlas.AtlasErrorCode;
 import org.apache.atlas.AtlasException;
 import org.apache.atlas.AtlasServiceException;
@@ -167,7 +168,8 @@ public class ExportService {
         return statuses;
     }
 
-    private AtlasExportResult.OperationStatus getOverallOperationStatus(AtlasExportResult.OperationStatus... statuses) {
+    @VisibleForTesting
+    AtlasExportResult.OperationStatus getOverallOperationStatus(AtlasExportResult.OperationStatus... statuses) {
         AtlasExportResult.OperationStatus overall = (statuses.length == 0) ?
                 AtlasExportResult.OperationStatus.FAIL : statuses[0];
 

http://git-wip-us.apache.org/repos/asf/atlas/blob/1dee77af/repository/src/main/java/org/apache/atlas/repository/impexp/TypeAttributeDifference.java
----------------------------------------------------------------------
diff --git a/repository/src/main/java/org/apache/atlas/repository/impexp/TypeAttributeDifference.java b/repository/src/main/java/org/apache/atlas/repository/impexp/TypeAttributeDifference.java
index b3c790a..37071f2 100644
--- a/repository/src/main/java/org/apache/atlas/repository/impexp/TypeAttributeDifference.java
+++ b/repository/src/main/java/org/apache/atlas/repository/impexp/TypeAttributeDifference.java
@@ -17,6 +17,7 @@
  */
 package org.apache.atlas.repository.impexp;
 
+import com.google.common.annotations.VisibleForTesting;
 import org.apache.atlas.AtlasErrorCode;
 import org.apache.atlas.exception.AtlasBaseException;
 import org.apache.atlas.model.impexp.AtlasImportResult;
@@ -92,7 +93,8 @@ public class TypeAttributeDifference {
         }
     }
 
-    private boolean addElements(AtlasEnumDef existing, AtlasEnumDef incoming) throws AtlasBaseException {
+    @VisibleForTesting
+    boolean addElements(AtlasEnumDef existing, AtlasEnumDef incoming) throws AtlasBaseException {
         return addElements(existing, getElementsAbsentInExisting(existing, incoming));
     }
 
@@ -100,7 +102,8 @@ public class TypeAttributeDifference {
         return addAttributes(existing, getElementsAbsentInExisting(existing, incoming));
     }
 
-    private List<AtlasStructDef.AtlasAttributeDef> getElementsAbsentInExisting(AtlasStructDef existing, AtlasStructDef incoming) throws AtlasBaseException {
+    @VisibleForTesting
+    List<AtlasStructDef.AtlasAttributeDef> getElementsAbsentInExisting(AtlasStructDef existing, AtlasStructDef incoming) throws AtlasBaseException {
         List<AtlasStructDef.AtlasAttributeDef> difference = new ArrayList<>();
         for (AtlasStructDef.AtlasAttributeDef attr : incoming.getAttributeDefs()) {
             updateCollectionWithDifferingAttributes(difference, existing, attr);
@@ -123,7 +126,8 @@ public class TypeAttributeDifference {
         }
     }
 
-    private List<AtlasEnumDef.AtlasEnumElementDef> getElementsAbsentInExisting(AtlasEnumDef existing, AtlasEnumDef incoming) throws AtlasBaseException {
+    @VisibleForTesting
+    List<AtlasEnumDef.AtlasEnumElementDef> getElementsAbsentInExisting(AtlasEnumDef existing, AtlasEnumDef incoming) throws AtlasBaseException {
         List<AtlasEnumDef.AtlasEnumElementDef> difference = new ArrayList<>();
         for (AtlasEnumDef.AtlasEnumElementDef ed : incoming.getElementDefs()) {
             updateCollectionWithDifferingAttributes(existing, difference, ed);

http://git-wip-us.apache.org/repos/asf/atlas/blob/1dee77af/repository/src/test/java/org/apache/atlas/discovery/EntityDiscoveryServiceTest.java
----------------------------------------------------------------------
diff --git a/repository/src/test/java/org/apache/atlas/discovery/EntityDiscoveryServiceTest.java b/repository/src/test/java/org/apache/atlas/discovery/EntityDiscoveryServiceTest.java
new file mode 100644
index 0000000..91d163c
--- /dev/null
+++ b/repository/src/test/java/org/apache/atlas/discovery/EntityDiscoveryServiceTest.java
@@ -0,0 +1,125 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.atlas.discovery;
+
+import org.apache.atlas.TestModules;
+import org.apache.atlas.exception.AtlasBaseException;
+import org.apache.atlas.model.typedef.AtlasEntityDef;
+import org.apache.atlas.type.AtlasTypeRegistry;
+import org.apache.commons.lang.StringUtils;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Guice;
+import org.testng.annotations.Test;
+
+import javax.inject.Inject;
+
+import static org.testng.Assert.*;
+
+@Guice(modules = TestModules.TestOnlyModule.class)
+public class EntityDiscoveryServiceTest {
+
+    private final String TEST_TYPE                = "test";
+    private final String TEST_TYPE1               = "test1";
+    private final String TEST_TYPE2               = "test2";
+    private final String TEST_TYPE3               = "test3";
+    private final String TEST_TYPE_WITH_SUB_TYPES = "testTypeWithSubTypes";
+    private AtlasTypeRegistry typeRegistry = new AtlasTypeRegistry();
+
+    AtlasEntityDef typeTest         = null;
+    AtlasEntityDef typeTest1        = null;
+    AtlasEntityDef typeTest2        = null;
+    AtlasEntityDef typeTest3        = null;
+    AtlasEntityDef typeWithSubTypes = null;
+
+    private final int maxTypesStrLengthInIdxQuery = 55;
+
+    @Inject
+    EntityDiscoveryService discoveryService;
+
+
+    @BeforeClass
+    public void init() throws AtlasBaseException {
+        typeTest         = new AtlasEntityDef(TEST_TYPE);
+        typeTest1        = new AtlasEntityDef(TEST_TYPE1);
+        typeTest2        = new AtlasEntityDef(TEST_TYPE2);
+        typeTest3        = new AtlasEntityDef(TEST_TYPE3);
+        typeWithSubTypes = new AtlasEntityDef(TEST_TYPE_WITH_SUB_TYPES);
+
+        typeTest1.addSuperType(TEST_TYPE_WITH_SUB_TYPES);
+        typeTest2.addSuperType(TEST_TYPE_WITH_SUB_TYPES);
+        typeTest3.addSuperType(TEST_TYPE_WITH_SUB_TYPES);
+
+        AtlasTypeRegistry.AtlasTransientTypeRegistry ttr = typeRegistry.lockTypeRegistryForUpdate();
+
+        ttr.addType(typeTest);
+        ttr.addType(typeWithSubTypes);
+        ttr.addType(typeTest1);
+        ttr.addType(typeTest2);
+        ttr.addType(typeTest3);
+
+        typeRegistry.releaseTypeRegistryForUpdate(ttr, true);
+    }
+
+    @Test
+    public void getSubTypesForType_NullStringReturnsEmptyString() throws Exception {
+        invokeGetSubTypesForType(null, maxTypesStrLengthInIdxQuery);
+    }
+
+    @Test
+    public void getSubTypesForType_BlankStringReturnsEmptyString() throws Exception {
+        invokeGetSubTypesForType(" ", maxTypesStrLengthInIdxQuery);
+    }
+
+    @Test
+    public void getSubTypesForType_EmptyStringReturnsEmptyString() throws Exception {
+        invokeGetSubTypesForType("", maxTypesStrLengthInIdxQuery);
+    }
+
+    @Test
+    public void getSubTypeForTypeWithNoSubType_ReturnsTypeString() throws Exception {
+        String s = invokeGetSubTypesForType(TEST_TYPE, 10);
+
+        assertEquals(s, "(" + TEST_TYPE + ")");
+    }
+
+    @Test
+    public void getSubTypeForTypeWithSubTypes_ReturnsOrClause() throws Exception {
+        String s = invokeGetSubTypesForType(TEST_TYPE_WITH_SUB_TYPES, maxTypesStrLengthInIdxQuery);
+
+        assertTrue(s.startsWith("("));
+        assertTrue(s.contains(TEST_TYPE_WITH_SUB_TYPES));
+        assertTrue(s.contains(TEST_TYPE1));
+        assertTrue(s.contains(TEST_TYPE2));
+        assertTrue(s.contains(TEST_TYPE3));
+        assertTrue(s.endsWith(")"));
+    }
+
+    @Test
+    public void getSubTypeForTypeWithSubTypes_ReturnsEmptyString() throws Exception {
+        String s = invokeGetSubTypesForType(TEST_TYPE_WITH_SUB_TYPES, 20);
+
+        assertTrue(StringUtils.isBlank(s));
+    }
+
+    private String invokeGetSubTypesForType(String inputString, int maxSubTypes) throws Exception {
+        String s = EntityDiscoveryService.getTypeFilter(typeRegistry, inputString, maxSubTypes);
+
+        assertNotNull(s);
+        return s;
+    }
+}

http://git-wip-us.apache.org/repos/asf/atlas/blob/1dee77af/repository/src/test/java/org/apache/atlas/repository/impexp/ExportServiceTest.java
----------------------------------------------------------------------
diff --git a/repository/src/test/java/org/apache/atlas/repository/impexp/ExportServiceTest.java b/repository/src/test/java/org/apache/atlas/repository/impexp/ExportServiceTest.java
index 8eb7a51..7901ef6 100644
--- a/repository/src/test/java/org/apache/atlas/repository/impexp/ExportServiceTest.java
+++ b/repository/src/test/java/org/apache/atlas/repository/impexp/ExportServiceTest.java
@@ -37,7 +37,6 @@ import org.apache.atlas.repository.store.graph.v1.EntityGraphMapper;
 import org.apache.atlas.repository.store.graph.v1.SoftDeleteHandlerV1;
 import org.apache.atlas.store.AtlasTypeDefStore;
 import org.apache.atlas.type.AtlasTypeRegistry;
-import org.powermock.reflect.Whitebox;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.testng.Assert;
@@ -264,38 +263,29 @@ public class ExportServiceTest {
     public void verifyOverallStatus() throws Exception {
 
 //        ExportService service = new ExportService(typeRegistry);
-        assertEquals(AtlasExportResult.OperationStatus.FAIL, Whitebox.invokeMethod(exportService,
-                "getOverallOperationStatus"));
+        assertEquals(AtlasExportResult.OperationStatus.FAIL, exportService.getOverallOperationStatus());
 
-        assertEquals(AtlasExportResult.OperationStatus.SUCCESS, Whitebox.invokeMethod(exportService,
-                "getOverallOperationStatus",
-                AtlasExportResult.OperationStatus.SUCCESS));
+        assertEquals(AtlasExportResult.OperationStatus.SUCCESS, exportService.getOverallOperationStatus(AtlasExportResult.OperationStatus.SUCCESS));
 
-        assertEquals(AtlasExportResult.OperationStatus.SUCCESS, Whitebox.invokeMethod(exportService,
-                "getOverallOperationStatus",
+        assertEquals(AtlasExportResult.OperationStatus.SUCCESS, exportService.getOverallOperationStatus(
                                 AtlasExportResult.OperationStatus.SUCCESS,
                                 AtlasExportResult.OperationStatus.SUCCESS,
                                 AtlasExportResult.OperationStatus.SUCCESS));
 
-        assertEquals(AtlasExportResult.OperationStatus.PARTIAL_SUCCESS, Whitebox.invokeMethod(exportService,
-                "getOverallOperationStatus",
+        assertEquals(AtlasExportResult.OperationStatus.PARTIAL_SUCCESS, exportService.getOverallOperationStatus(
                 AtlasExportResult.OperationStatus.FAIL,
                 AtlasExportResult.OperationStatus.PARTIAL_SUCCESS,
                 AtlasExportResult.OperationStatus.SUCCESS));
 
-        assertEquals(AtlasExportResult.OperationStatus.PARTIAL_SUCCESS, Whitebox.invokeMethod(exportService,
-                "getOverallOperationStatus",
+        assertEquals(AtlasExportResult.OperationStatus.PARTIAL_SUCCESS, exportService.getOverallOperationStatus(
                 AtlasExportResult.OperationStatus.FAIL,
                 AtlasExportResult.OperationStatus.FAIL,
                 AtlasExportResult.OperationStatus.PARTIAL_SUCCESS));
 
-        assertEquals(AtlasExportResult.OperationStatus.FAIL, Whitebox.invokeMethod(exportService,
-                "getOverallOperationStatus",
+        assertEquals(AtlasExportResult.OperationStatus.FAIL, exportService.getOverallOperationStatus(
                 AtlasExportResult.OperationStatus.FAIL,
                 AtlasExportResult.OperationStatus.FAIL,
                 AtlasExportResult.OperationStatus.FAIL));
-
-
     }
 
     @Test

http://git-wip-us.apache.org/repos/asf/atlas/blob/1dee77af/repository/src/test/java/org/apache/atlas/repository/impexp/TypeAttributeDifferenceTest.java
----------------------------------------------------------------------
diff --git a/repository/src/test/java/org/apache/atlas/repository/impexp/TypeAttributeDifferenceTest.java b/repository/src/test/java/org/apache/atlas/repository/impexp/TypeAttributeDifferenceTest.java
index cf17ef2..87cb1d4 100644
--- a/repository/src/test/java/org/apache/atlas/repository/impexp/TypeAttributeDifferenceTest.java
+++ b/repository/src/test/java/org/apache/atlas/repository/impexp/TypeAttributeDifferenceTest.java
@@ -21,7 +21,6 @@ import org.apache.atlas.model.typedef.AtlasBaseTypeDef;
 import org.apache.atlas.model.typedef.AtlasEntityDef;
 import org.apache.atlas.model.typedef.AtlasEnumDef;
 import org.apache.atlas.model.typedef.AtlasStructDef;
-import org.powermock.reflect.Whitebox;
 import org.testng.Assert;
 import org.testng.annotations.BeforeClass;
 import org.testng.annotations.Test;
@@ -76,11 +75,11 @@ public class TypeAttributeDifferenceTest {
     }
 
     private List<AtlasStructDef.AtlasAttributeDef> invokeGetAttributesAbsentInExisting(AtlasStructDef existing, AtlasStructDef incoming) throws Exception {
-        return Whitebox.invokeMethod(typeAttributeDifference, "getElementsAbsentInExisting", existing, incoming);
+        return typeAttributeDifference.getElementsAbsentInExisting(existing, incoming);
     }
 
     private List<AtlasEnumDef.AtlasEnumElementDef> invokeGetAttributesAbsentInExisting(AtlasEnumDef existing, AtlasEnumDef incoming) throws Exception {
-        return Whitebox.invokeMethod(typeAttributeDifference, "getElementsAbsentInExisting", existing, incoming);
+        return typeAttributeDifference.getElementsAbsentInExisting(existing, incoming);
     }
 
     private AtlasEnumDef getAtlasEnumWithAttributes(String... elements) {
@@ -146,6 +145,6 @@ public class TypeAttributeDifferenceTest {
     }
 
     private boolean invokeUpdate(AtlasEnumDef existing, AtlasEnumDef incoming) throws Exception {
-        return Whitebox.invokeMethod(typeAttributeDifference, "addElements", existing, incoming);
+        return typeAttributeDifference.addElements(existing, incoming);
     }
 }

http://git-wip-us.apache.org/repos/asf/atlas/blob/1dee77af/repository/src/test/java/org/apache/atlas/services/EntityDiscoveryServiceTest.java
----------------------------------------------------------------------
diff --git a/repository/src/test/java/org/apache/atlas/services/EntityDiscoveryServiceTest.java b/repository/src/test/java/org/apache/atlas/services/EntityDiscoveryServiceTest.java
deleted file mode 100644
index 5a0739c..0000000
--- a/repository/src/test/java/org/apache/atlas/services/EntityDiscoveryServiceTest.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.atlas.services;
-
-import org.apache.atlas.TestModules;
-import org.apache.atlas.discovery.EntityDiscoveryService;
-import org.apache.atlas.exception.AtlasBaseException;
-import org.apache.atlas.model.typedef.AtlasEntityDef;
-import org.apache.atlas.type.AtlasTypeRegistry;
-import org.apache.commons.lang.StringUtils;
-import org.powermock.reflect.Whitebox;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Guice;
-import org.testng.annotations.Test;
-
-import javax.inject.Inject;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.assertTrue;
-
-@Guice(modules = TestModules.TestOnlyModule.class)
-public class EntityDiscoveryServiceTest {
-
-    private final String TEST_TYPE                = "test";
-    private final String TEST_TYPE1               = "test1";
-    private final String TEST_TYPE2               = "test2";
-    private final String TEST_TYPE3               = "test3";
-    private final String TEST_TYPE_WITH_SUB_TYPES = "testTypeWithSubTypes";
-    private AtlasTypeRegistry typeRegistry = new AtlasTypeRegistry();
-
-    AtlasEntityDef typeTest         = null;
-    AtlasEntityDef typeTest1        = null;
-    AtlasEntityDef typeTest2        = null;
-    AtlasEntityDef typeTest3        = null;
-    AtlasEntityDef typeWithSubTypes = null;
-
-    private final int maxTypesStrLengthInIdxQuery = 55;
-
-    @Inject
-    EntityDiscoveryService discoveryService;
-
-
-    @BeforeClass
-    public void init() throws AtlasBaseException {
-        typeTest         = new AtlasEntityDef(TEST_TYPE);
-        typeTest1        = new AtlasEntityDef(TEST_TYPE1);
-        typeTest2        = new AtlasEntityDef(TEST_TYPE2);
-        typeTest3        = new AtlasEntityDef(TEST_TYPE3);
-        typeWithSubTypes = new AtlasEntityDef(TEST_TYPE_WITH_SUB_TYPES);
-
-        typeTest1.addSuperType(TEST_TYPE_WITH_SUB_TYPES);
-        typeTest2.addSuperType(TEST_TYPE_WITH_SUB_TYPES);
-        typeTest3.addSuperType(TEST_TYPE_WITH_SUB_TYPES);
-
-        AtlasTypeRegistry.AtlasTransientTypeRegistry ttr = typeRegistry.lockTypeRegistryForUpdate();
-
-        ttr.addType(typeTest);
-        ttr.addType(typeWithSubTypes);
-        ttr.addType(typeTest1);
-        ttr.addType(typeTest2);
-        ttr.addType(typeTest3);
-
-        typeRegistry.releaseTypeRegistryForUpdate(ttr, true);
-    }
-
-    @Test
-    public void getSubTypesForType_NullStringReturnsEmptyString() throws Exception {
-        invokeGetSubTypesForType(null, maxTypesStrLengthInIdxQuery);
-    }
-
-    @Test
-    public void getSubTypesForType_BlankStringReturnsEmptyString() throws Exception {
-        invokeGetSubTypesForType(" ", maxTypesStrLengthInIdxQuery);
-    }
-
-    @Test
-    public void getSubTypesForType_EmptyStringReturnsEmptyString() throws Exception {
-        invokeGetSubTypesForType("", maxTypesStrLengthInIdxQuery);
-    }
-
-    @Test
-    public void getSubTypeForTypeWithNoSubType_ReturnsTypeString() throws Exception {
-        String s = invokeGetSubTypesForType(TEST_TYPE, 10);
-
-        assertEquals(s, "(" + TEST_TYPE + ")");
-    }
-
-    @Test
-    public void getSubTypeForTypeWithSubTypes_ReturnsOrClause() throws Exception {
-        String s = invokeGetSubTypesForType(TEST_TYPE_WITH_SUB_TYPES, maxTypesStrLengthInIdxQuery);
-
-        assertTrue(s.startsWith("("));
-        assertTrue(s.contains(TEST_TYPE_WITH_SUB_TYPES));
-        assertTrue(s.contains(TEST_TYPE1));
-        assertTrue(s.contains(TEST_TYPE2));
-        assertTrue(s.contains(TEST_TYPE3));
-        assertTrue(s.endsWith(")"));
-    }
-
-    @Test
-    public void getSubTypeForTypeWithSubTypes_ReturnsEmptyString() throws Exception {
-        String s = invokeGetSubTypesForType(TEST_TYPE_WITH_SUB_TYPES, 20);
-
-        assertTrue(StringUtils.isBlank(s));
-    }
-
-    private String invokeGetSubTypesForType(String inputString, int maxSubTypes) throws Exception {
-        String s = Whitebox.invokeMethod(EntityDiscoveryService.class, "getTypeFilter", typeRegistry, inputString, maxSubTypes);
-
-        assertNotNull(s);
-        return s;
-    }
-}