Closed b2064832 closed 9 years ago
The enum value is there, but the MyEnum.getValue() method gets mocked, so it returns null. If cascading is disabled (with "@Mocked(cascading = false)"), then it doesn't get mocked and the test passes.
This said, since "mockable.getMyEnum()" was explicitly recorded to return a still unmocked enum element, it should have remained unmocked. I will fix that.
JMockit 1.13 corrupts enum values after recording expectations. Version 1.12 is working. Failing test:
import mockit.Mocked; import mockit.NonStrictExpectations; import org.testng.annotations.Test;
import static org.testng.Assert.assertEquals;
public class JMockitEnumTest { public static enum MyEnum { FOO("foo"); private final String value;
}