我想在Kotlin中编写Spek测试。测试应从文件src/test/resources
夹中读取HTML文件。怎么做?
class MySpec : Spek({
describe("blah blah") {
given("blah blah") {
var fileContent : String = ""
beforeEachTest {
// How to read the file file.html in src/test/resources/html
fileContent = ...
}
it("should blah blah") {
...
}
}
}
})
this::class.java.classLoader.getResource("/html/file.html").readText()