有人可以建议一种简单的方法来获取对junit测试类中的String/InputStream/File/etc类型对象的文件引用吗?显然,我可以将文件(在这种情况下为xml)粘贴为一个巨大的字符串,或者将其作为文件读取,但是有一个特定于Junit的快捷方式吗?
public class MyTestClass{
@Resource(path="something.xml")
File myTestFile;
@Test
public void toSomeTest(){
...
}
}
Run Code Online (Sandbox Code Playgroud)