Last active
July 26, 2020 13:56
-
-
Save wzieba/f90b4df002f69f02190c774b3c490841 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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