Created
March 23, 2021 14:44
-
-
Save bufferings/0812634ec5c6b61a69aba7fdc7bb1433 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
@Test | |
void testTextBlocks1() { | |
String html1 = "<html>\n" + | |
" <body>\n" + | |
" <p>Hello, world</p>\n" + | |
" </body>\n" + | |
"</html>\n"; | |
String html2 = """ | |
<html> | |
<body> | |
<p>Hello, world</p> | |
</body> | |
</html> | |
"""; | |
assertEquals(html1, html2); | |
} | |
@Test | |
void testTextBlocks2() { | |
String query1 = "SELECT \"EMP_ID\", \"LAST_NAME\" FROM \"EMPLOYEE_TB\"\n" + | |
"WHERE \"CITY\" = 'INDIANAPOLIS'\n" + | |
"ORDER BY \"EMP_ID\", \"LAST_NAME\";\n"; | |
String query2 = """ | |
SELECT "EMP_ID", "LAST_NAME" FROM "EMPLOYEE_TB" | |
WHERE "CITY" = 'INDIANAPOLIS' | |
ORDER BY "EMP_ID", "LAST_NAME"; | |
"""; | |
assertEquals(query1, query2); | |
} | |
@Test | |
void testTextBlocks3() { | |
String source1 = """ | |
public void print(MyClass object) { | |
System.out.println(Objects.toString(object)); | |
} | |
"""; | |
String source2 = """ | |
public void print(%s object) { | |
System.out.println(Objects.toString(object)); | |
} | |
""".formatted("MyClass"); | |
assertEquals(source1, source2); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment