The problem here is that MockUp
treats JM_nested_class_cons.Nested
as a regular, non-inner, class. So, it's not taking into account that each constructor has a hidden first parameter for the outer object (JM_nested_class_cons
).
A work-around is to explicitly declare this extra parameter in the @Mock
method for the constructor of the inner class:
@Mock
void $init(JM_nested_class_cons outer, int i) {
System.out.println("Hi!");
}