Problem in running test which reads a sql file


(rajesh.eq) #1

I have a project structure as below |–dev

|–build

|

|–gradle

|

|–build.gradle

|

|–target

|–classes

|

|–test

|

|–FileReadTest.class

|–resources

|–test

|–folder1

|–test.sql

Inside my ‘FirstReadTest.java’ I am trying to read the sql file ‘test.sql’ using new File(“folder1/test.sql”). Eventhough the test.sql file is available in ‘dev/target/resources/test/folder1’ while running the test, FirstReadTest throws exception stating can’t find file ‘test.sql’. When I copy and paste ‘folder1/test.sql’ to the directory where my build.gradle is present it works fine. How can I make it work from ‘dev/target/resources/test/folder1/test.sql’ instead of ‘dev/build/gradle/folder1/test.sql’


(rajesh.eq) #2

As the dir structure is not clear above attaching a image below: