Skip to content

Commit

Permalink
TEMP: Log subtypes in TypeRegistryImplTest
Browse files Browse the repository at this point in the history
  • Loading branch information
eviltak committed Aug 10, 2019
1 parent 66a9dcd commit 09ce222
Showing 1 changed file with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,14 @@

import org.junit.Test;
import org.reflections.Reflections;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.terasology.ModuleEnvironmentTest;
import org.terasology.entitySystem.Component;
import org.terasology.naming.Name;
import org.terasology.utilities.ReflectionUtil;

import java.util.Arrays;
import java.util.Collection;
import java.util.Set;
import java.util.TreeSet;
Expand All @@ -29,13 +33,25 @@
import static org.junit.Assert.assertTrue;

public class TypeRegistryImplTest extends ModuleEnvironmentTest {
private static final Logger LOGGER = LoggerFactory.getLogger(TypeRegistryImplTest.class);

static {
Reflections.log = null;
}

@Test
public void testRegistry() {
assertTrue(typeRegistry.getSubtypesOf(Collection.class).contains(TreeSet.class));
Set<Class<? extends Collection>> collectionSubtypes = typeRegistry.getSubtypesOf(Collection.class);

ClassLoader[] classLoaders = (ClassLoader[]) ReflectionUtil.readField(typeRegistry, "classLoaders");
ClassLoader thisClassLoader = getClass().getClassLoader();

LOGGER.info("Class Loaders: {}", Arrays.toString(classLoaders));
LOGGER.info("Is this class loader ({}) loaded: {}", thisClassLoader, Arrays.asList(classLoaders).contains(thisClassLoader));

LOGGER.info("{}", collectionSubtypes);

assertTrue(collectionSubtypes.contains(TreeSet.class));

Set<Name> modulesDeclaringComponents =
typeRegistry.getSubtypesOf(Component.class).stream()
Expand Down

0 comments on commit 09ce222

Please sign in to comment.