How to get content of URI resource (file, website) ?

To get content of file or website, we can simply use getText() method applied as well for File class, as for URL.

@Test
void "should correctly read web page to String"() {
  def url = "http://www.waitingforcode.com".toURL()

  String content = url.text

  assertThat(content).isNotEmpty()
}