Search in sources :

Example 1 with ExampleClass

use of org.terasology.unittest.ExampleClass in project Terasology by MovingBlocks.

the class ClasspathCompromisingModuleFactoryTest method directoryModuleContainsClass.

@Test
public void directoryModuleContainsClass() {
    // This test assumes that the unittest module is under the current working directory (`engine-test/`)
    File engineTestDirectory = new File(System.getProperty("user.dir", "."));
    ModuleMetadata metadata = new ModuleMetadata(new Name("unittest"), new Version("1.0.0"));
    Module module = factory.createDirectoryModule(metadata, engineTestDirectory);
    // and that ExampleClass is inside that directory
    assertTrue(module.getClassPredicate().test(ExampleClass.class));
    // and that this other class (in engine, not engine-test) is outside that directory.
    assertFalse(module.getClassPredicate().test(someClassOutsideTheModule));
// These assumptions could break if things get moved around enough.
}
Also used : ExampleClass(org.terasology.unittest.ExampleClass) Version(org.terasology.gestalt.naming.Version) ModuleMetadata(org.terasology.gestalt.module.ModuleMetadata) Module(org.terasology.gestalt.module.Module) File(java.io.File) Name(org.terasology.gestalt.naming.Name) Test(org.junit.jupiter.api.Test)

Aggregations

File (java.io.File)1 Test (org.junit.jupiter.api.Test)1 Module (org.terasology.gestalt.module.Module)1 ModuleMetadata (org.terasology.gestalt.module.ModuleMetadata)1 Name (org.terasology.gestalt.naming.Name)1 Version (org.terasology.gestalt.naming.Version)1 ExampleClass (org.terasology.unittest.ExampleClass)1