New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Partial mocking of global MockUps causes NullPointerException #62

borisbrodski opened this Issue Sep 12, 2014 · 1 comment


2 participants

borisbrodski commented Sep 12, 2014

Reproduction steps:

Create following files:
public class Tool {
    public void doIt() {
import mockit.Invocation;
import mockit.Mock;
import mockit.MockUp;

public class ToolMock extends MockUp<Tool>{
    public void doIt(Invocation e){
import mockit.NonStrictExpectations;

import org.junit.Test;

public class Test1 {
    public void test1() {
        new NonStrictExpectations(Tool.class) {{

    public void test2() {
        new Tool().doIt();
Run Test1.


  • Test1.test1 OK
  • Test1.test2 FAILS. Exception:
    at test.Tool.doIt(
    at test.Test1.test2(

Also all consequent tests getting the same NullPointerException, if Tool class get used.

@rliesenfeld rliesenfeld added the bug label Sep 12, 2014

@rliesenfeld rliesenfeld self-assigned this Sep 12, 2014


This comment has been minimized.

Show comment
Hide comment

rliesenfeld Sep 12, 2014


Well spotted, thanks! It will be fixed for release 1.12.


rliesenfeld commented Sep 12, 2014

Well spotted, thanks! It will be fixed for release 1.12.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment