Junit + getResourceAsStream Returning Null

后端 未结 13 1426
情话喂你
情话喂你 2020-12-15 03:32

Not sure how this is possible. I re-read up on getResourceAsStream and it\'s always returning null.

InputStream source = this.getClass().getResourceAsStream(         


        
13条回答
  •  渐次进展
    2020-12-15 03:40

    Put test.xml in the src/main/resources (or src/test/resources).

    File file = ResourceUtils.getFile("classpath:test.xml");
    String test = new String(Files.readAllBytes(file.toPath()));
    

提交回复
热议问题