import static org.junit.Assert.assertEquals;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.api.mockito.PowerMockito;
import org.powermock.api.support.membermodification.MemberModifier;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
@RunWith(PowerMockRunner.class)
@PrepareForTest({ MyClass.class })
public class MyClassTest {
@Test
public void testPrivateMethod() throws Exception {
MyClass myClass = PowerMockito.mock(MyClass.class);
PowerMockito.when(myClass, "privateMethod").thenReturn("Mocked Value");
String result = myClass.callPrivateMethod();
assertEquals("Mocked Value", result);
}
}