With this enum:
public enum Testnum {
A("a"), B("b");
String x;
private Testnum(String x) {
this.x = x;
}
}
The assertFalse in this test fails:
import static org.junit.Assert.assertFalse;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.api.mockito.PowerMockito;
import org.powermock.core.classloader.annotations.SuppressStaticInitializationFor;
import org.powermock.modules.junit4.PowerMockRunner;
@RunWith(PowerMockRunner.class)
@SuppressStaticInitializationFor("Testnum")
public class EnumTest {
@Test
public void mainSuccess() {
PowerMockito.mockStatic(Testnum.class);
assertFalse(Testnum.A == Testnum.B);
}
}
Any idea why / how I can work around this?
Aucun commentaire:
Enregistrer un commentaire