Mock a private static field with JMockit?
问题 I have a class like the following; class ClassA { private static File myDir; // myDir is created at some stage private static String findFile(final String fileName) { for (final String actualBackupFileName : myDir.list()) { if (actualBackupFileName.startsWith(removeExtensionFrom(backupFile))) { return actualBackupFileName; } } } } So, basically, I want to test this class by mocking out the File class so that when list() is called on it it returns a list of strings I define in my test class. I