import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.api.mockito.PowerMockito;
import org.powermock.core.classloader.annotations.PrepareForTest;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
@RunWith(PowerMockRunner.class)
@PrepareForTest({ClassToBeTested.class})
public class ClassToBeTestedTest {
@Test
public void testMethodToBeTested() throws Exception {
PowerMockito.mockStatic(ClassToBeTested.class);
when(ClassToBeTested.staticMethod()).thenReturn(10);
ClassToBeTested obj = new ClassToBeTested();
int result = obj.methodToBeTested();
PowerMockito.verifyStatic(ClassToBeTested.class);
ClassToBeTested.staticMethod();
assertEquals(10, result);
}
}