Junit + getResourceAsStream Returning Null

后端 未结 13 1404
情话喂你
情话喂你 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

    getResourceAsStream() is using the CLASSPATH, and as such it will load from wherever your classes are, not your source files.

    I suspect you need to copy your XML to the same directory as your .class file.

提交回复
热议问题