roscopeco/moxy

Moxy fails to mock methods from superinterfaces

Closed this issue · 0 comments

Describe the bug
When mocking an interface, Moxy fails to mock methods inherited from superinterfaces.

To Reproduce

import org.junit.jupiter.api.Test;

import com.roscopeco.moxy.Moxy;

class MoxyBug {
    public interface Super {
        void superMethod();
    }

    public interface Sub extends Super {
        void subMethod();
    }

    @Test
    void testMoxyBug() {
        final Sub sub = Moxy.mock(Sub.class, System.out);

        sub.subMethod();        // Works fine
        sub.superMethod();      // AbstractMethodError is thrown; Output shows superMethod was *not* generated
    }
}

Expected behavior
sub.superMethod() should be mocked; AbstractMethodError should not be thrown.

Stacktraces
java.lang.AbstractMethodError: Method com/tr/utp/spring/solace/Mock Sub {0}.superMethod()V is abstract

Environment (please complete the following information):

  • Moxy version: 0.92.1
  • OS: Any
  • JVM Vendor: Any
  • JVM Version: Any