Skip to content

Add 'exportsTo' configuration option similar to 'opensTo' #67

@xenoterracide

Description

@xenoterracide
java.lang.reflect.InaccessibleObjectException: Unable to make public void org.mockito.moduletest.ModuleHandlingTest.can_define_class_in_open_java_util_module() throws java.lang.Exception accessible: module mockito.module.test.test does not "exports org.mockito.moduletest" to module junit
plugins {
    id 'org.gradlex.java-module-testing' version '1.4'
}

configurations {
    testUtil //TODO move to separate project
    // Putting 'provided' dependencies on test compile and runtime classpath.
    testCompileOnly.extendsFrom(compileOnly)
    testRuntimeOnly.extendsFrom(compileOnly)
}

dependencies {
    // scratching head, api but also optional...
    api libraries.bytebuddy, libraries.bytebuddyagent

    compileOnly libraries.junit4, libraries.hamcrest, libraries.opentest4j
    implementation libraries.objenesis

    testImplementation libraries.assertj
    testImplementation libraries.junitJupiterApi
    testImplementation libraries.junitJupiterParams
}

javaModuleTesting.whitebox(testing.suites["test"]) {
    requires.add("org.junit.jupiter.api")
    requires.add("org.junit.jupiter.params")
    requires.add("org.assertj.core")
    requires.add("java.sql")
    requires.add("java.management")
    // opensTo.add("junit")
}
module org.mockito {
    requires java.instrument;
    requires jdk.attach; // GH #2952
    requires static org.opentest4j;
    requires static net.bytebuddy;
    requires static net.bytebuddy.agent;
    requires static junit;

    opens org.mockito;

    exports org.mockito;
    exports org.mockito.codegen;
    exports org.mockito.configuration;
    exports org.mockito.creation.instance;
    exports org.mockito.exceptions.base;
    exports org.mockito.exceptions.misusing;
    exports org.mockito.exceptions.verification;
    exports org.mockito.exceptions.verification.junit;
    exports org.mockito.exceptions.verification.opentest4j;
    exports org.mockito.hamcrest;
    exports org.mockito.invocation;
    exports org.mockito.junit;
    exports org.mockito.listeners;
    exports org.mockito.mock;
    exports org.mockito.plugins;
    exports org.mockito.quality;
    exports org.mockito.session;
    exports org.mockito.stubbing;
    exports org.mockito.verification;

    // TODO: remove internal exports
    exports org.mockito.internal;
    exports org.mockito.internal.configuration.plugins;
    exports org.mockito.internal.util.reflection;
    exports org.mockito.internal.creation.bytebuddy;
}

https://github.com/xenoterracide/mockito/pull/1/files

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions