-
Notifications
You must be signed in to change notification settings - Fork 238
Enum value corrupted after recording expectations in 1.13 #94
Copy link
Copy link
Closed
Labels
Description
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;
private MyEnum(final String value) {
this.value = value;
}
public String getValue() {
return value;
}
}
public static interface Mockable {
MyEnum getMyEnum();
}
@Test
public void test(@Mocked final Mockable mockable) throws Exception {
assertEquals(MyEnum.FOO.getValue(), "foo");
new NonStrictExpectations() {{ //or Expectations
mockable.getMyEnum();
result = MyEnum.FOO;
}};
assertEquals(MyEnum.FOO.getValue(), "foo", "Enum value corrupted after mocking."); // fails here, value null
}
}
Reactions are currently unavailable