Skip to content

Instantly share code, notes, and snippets.

@wzieba
Last active July 26, 2020 13:56
Show Gist options
  • Save wzieba/f90b4df002f69f02190c774b3c490841 to your computer and use it in GitHub Desktop.
Save wzieba/f90b4df002f69f02190c774b3c490841 to your computer and use it in GitHub Desktop.
fun main() {
val stringAssignedInCode = "foo\nbar"
val plainStringFromFile: String = this::class.java.classLoader.getResource("saved_line")!!.readText()
val stringSimplyReplaced = plainStringFromFile.replace("\\n", "\n")
val stringUnescapedWithApacheCommons = StringEscapeUtils.unescapeJava(plainStringFromFile)
assertThat(stringAssignedInCode).isEqualTo(stringSimplyReplaced)
assertThat(stringAssignedInCode).isEqualTo(stringUnescapedWithApacheCommons)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment