PowerMock - Mocking static system class throws IllegalStateException
问题 I have the following code 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() {