mirror of https://github.com/apache/nifi.git
Added more test for escape and unescape functions
Signed-off-by: Matt Burgess <mattyb149@apache.org>
This commit is contained in:
parent
8f74241a10
commit
219e0e96fb
|
@ -1320,6 +1320,38 @@ public class TestQuery {
|
||||||
|
|
||||||
attributes.put("string", "making air \"QUOTES\".");
|
attributes.put("string", "making air \"QUOTES\".");
|
||||||
verifyEquals("${string:escapeJson()}", attributes, "making air \\\"QUOTES\\\".");
|
verifyEquals("${string:escapeJson()}", attributes, "making air \\\"QUOTES\\\".");
|
||||||
|
|
||||||
|
attributes.put("string", "M & M");
|
||||||
|
verifyEquals("${string:escapeXml()}", attributes, "M & M");
|
||||||
|
|
||||||
|
attributes.put("string", "making air \"QUOTES\".");
|
||||||
|
verifyEquals("${string:escapeCsv()}", attributes, "\"making air \"\"QUOTES\"\".\"");
|
||||||
|
|
||||||
|
attributes.put("string", "special ¡");
|
||||||
|
verifyEquals("${string:escapeHtml3()}", attributes, "special ¡");
|
||||||
|
|
||||||
|
attributes.put("string", "special ♣");
|
||||||
|
verifyEquals("${string:escapeHtml4()}", attributes, "special ♣");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testUnescapeFunctions() {
|
||||||
|
final Map<String, String> attributes = new HashMap<>();
|
||||||
|
|
||||||
|
attributes.put("string", "making air \\\"QUOTES\\\".");
|
||||||
|
verifyEquals("${string:unescapeJson()}", attributes, "making air \"QUOTES\".");
|
||||||
|
|
||||||
|
attributes.put("string", "M & M");
|
||||||
|
verifyEquals("${string:unescapeXml()}", attributes, "M & M");
|
||||||
|
|
||||||
|
attributes.put("string", "\"making air \"\"QUOTES\"\".\"");
|
||||||
|
verifyEquals("${string:unescapeCsv()}", attributes, "making air \"QUOTES\".");
|
||||||
|
|
||||||
|
attributes.put("string", "special ¡");
|
||||||
|
verifyEquals("${string:unescapeHtml3()}", attributes, "special ¡");
|
||||||
|
|
||||||
|
attributes.put("string", "special ♣");
|
||||||
|
verifyEquals("${string:unescapeHtml4()}", attributes, "special ♣");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void verifyEquals(final String expression, final Map<String, String> attributes, final Object expectedResult) {
|
private void verifyEquals(final String expression, final Map<String, String> attributes, final Object expectedResult) {
|
||||||
|
|
Loading…
Reference in New Issue