目的
编写whenNew测试代码,模拟新建对象其方法的执行结果
准备工作
mockito、easymock、powermock使用(2)-准备工作
测试代码
import com.suning.work.controller.MockController;
import junit.framework.TestCase;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.MockitoAnnotations;
import org.powermock.api.mockito.PowerMockito;
import org.powermock.core.classloader.annotations.PowerMockIgnore;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import java.io.File;
@RunWith(PowerMockRunner.class)
@PowerMockIgnore("javax.management.*")
public class MockWhenNewTest extends TestCase {
@InjectMocks
MockController mockController;
@Before
public void set