To get a content of file from classpath, we can use the mix of getClass() and getText methods:
@Test
void "should correctly load file content from classpath"() {
// sample_file.txt located in /test/resources directory
String content = this.getClass().getResource('/sample_file.txt').text
assertThat(content).isEqualTo('Sample file')
}