How to access test resources in Scala?

后端 未结 5 884
难免孤独
难免孤独 2020-12-04 07:58

I have a file data.xml in src/test/resources/.

How can I read that file into a new FileReader in my test data.scala

5条回答
  •  醉梦人生
    2020-12-04 08:31

    And in cases where getClass.getResource does not work (don't know nor care when or why exactly), com.google.common.io.Resources.getResource from Google Guava usually does

    testCompile "com.google.guava:guava:18.0"
    

提交回复
热议问题