Description
It seems that a fake implementation of an interface does not have the same access privilege as an implementation created inside the same package as the interface. (I know it's a really strange use case...)
The code below causes the following error: java.lang.IllegalAccessError: tried to access class package.PackagePrivateClass from class package.$Impl_TestInterface
Code to Reproduce
ExampleTest.java:
import mockit.Mocked;
import org.junit.Test;
public class ExampleTest
{
@SuppressWarnings("unused") @Mocked private TestInterface mockedTestInterface = null;
@Test
public void test()
{
mockedTestInterface.getPackagePrivateClass();
}
}
TestInterface.java
public interface TestInterface
{
PackagePrivateClass getPackagePrivateClass();
}
PackagePrivateClass.java
class PackagePrivateClass
{
}
The text was updated successfully, but these errors were encountered:
Version
JMockit: 1.33
JUnit: 4.11
Java: 1.8.0_66
Description
It seems that a fake implementation of an interface does not have the same access privilege as an implementation created inside the same package as the interface. (I know it's a really strange use case...)
The code below causes the following error:
java.lang.IllegalAccessError: tried to access class package.PackagePrivateClass from class package.$Impl_TestInterface
Code to Reproduce
ExampleTest.java:
TestInterface.java
PackagePrivateClass.java
The text was updated successfully, but these errors were encountered: