jmockit / jmockit1

Advanced Java library for integration testing, mocking, faking, and code coverage
Other
461 stars 239 forks source link

Invalid mock-up for internal class #675

Closed ctlove0523 closed 4 years ago

ctlove0523 commented 4 years ago

I checked issue 326,but found not help me.

jmockit version:1.28

What confuse me is the mocked class is not a internal class, the below is my code:

public class CipherUtil {
    private static final HCCipherUtil CIPHER = new B();

    public static String encrypt(String plaintText) {
        return CIPHER.encrypt(plaintText);
    }

    public static String decrypt(String cipherText) {
        return CIPHER.decrypt(cipherText);
    }
}

I use the below code to mock:

new MockUp<CipherUtil>() {
    @Mock
    public String encrypt(String plaintText) {
        return plaintText;
    }

    @Mock
    public String decrypt(String cipherText) {
        return cipherText;
    }
};

it's works well but i get warning message: Invalid mock-up for internal class CipherUtil class.