https://kotlinlang.org logo
k

Kris Wong

02/26/2019, 4:28 PM
is it possible to load a text file resource in a unit test from the 'jvmTest' source set? javaClass.getResource("/filename") does not seem to be working.
d

Dico

02/27/2019, 1:09 AM
I had the same problem.
k

Kris Wong

02/27/2019, 1:08 PM
yeah I was not able to find any solution. ended up just pasting the text content into my tests.
d

Dico

02/27/2019, 2:32 PM
I made the tests read the file from the source path 😂
k

Kris Wong

02/27/2019, 3:02 PM
is the test working directory just the project source root?
d

Dico

02/27/2019, 3:22 PM
It's the directory containg
src
You might want to set the working dir of the gradle task
runTestJvm
k

Kris Wong

02/27/2019, 3:26 PM
gotcha, thanks
9 Views