Tag: powermock illegalstateexception

PowerMock – 模拟静态系统类抛出IllegalStateException

我有以下代码 public class A{ public void createFile() { File tempXmlFile = null; String extension = “.xml”; String name = “someName”; try { tempXmlFile = File.createTempFile(name, extension); if (tempXmlFile.exists()) { tempXmlFile.delete(); } } catch (IOException e) { System.out.println(e.getStackTrace()); } } } @RunWith(PowerMockRunner.class) @PrepareForTest(A.class) public class testA extends TestCase{ private A classUnderTest; @Override @Before public void setUp() […]