我不得不通过在Eclipse的JVM参数系统变量设定的文件夹路径,我试图访问它在我的课为:
System.getProperty("my_files_path").
在为这个类编写junit测试方法时,我尝试模拟这个调用,因为测试类不考虑JVM参数.我已经使用PowerMockito来模拟静态System类,并尝试System.getProperpty在调用时返回一些路径.
在课堂上有注释@RunWith(PowerMockRunner.class)和@PrepareForTest(System.class)注释.但是,System类没有被模拟,因此我总是得到null结果.任何帮助表示赞赏.