use of org.terasology.gestalt.module.sandbox.PermissionProvider in project Terasology by MovingBlocks.
the class ModuleManagerTest method nonApiClassesAreNotPermitted.
/**
* Non-API classes are not permitted.
* <p>
* Tests against the {@link PermissionProvider} that ModuleManager gives a module.
* <p>
* A test failure here may indicate that modules have unrestricted access to engine classes they
* should not.
* <p>
* ⚠ This test <em>passing</em> should <strong>not</strong> be taken to mean the protections
* of the sandbox are intact. The PermissionProvider provides only one piece of the logic and
* is not always the deciding factor.
*
* @param disallowedClass A class in {@code org.terasology.engine} not annotated with @API
* nor in any package annotated with @API.
*/
@ParameterizedTest
@ValueSource(classes = { PathManager.class, PermissionSetComponent.class })
public void nonApiClassesAreNotPermitted(Class<?> disallowedClass) {
PermissionProvider permissionProvider = manager.getPermissionProvider(getEmptyTestModule());
assertFalse(permissionProvider.isPermitted(disallowedClass));
}
Aggregations