GUACAMOLE-1081: Implement token modifiers for upper and lower case.

This commit is contained in:
Virtually Nick
2020-05-25 19:47:02 -04:00
parent e4aa6bd451
commit e216f83c49
2 changed files with 53 additions and 6 deletions

View File

@@ -39,6 +39,7 @@ public class TokenFilterTest {
TokenFilter tokenFilter = new TokenFilter();
tokenFilter.setToken("TOKEN_A", "value-of-a");
tokenFilter.setToken("TOKEN_B", "value-of-b");
tokenFilter.setToken("TOKEN_C", "Value-of-C");
// Test basic substitution and escaping
assertEquals(
@@ -48,8 +49,23 @@ public class TokenFilterTest {
// Unknown tokens must be interpreted as literals
assertEquals(
"${NOPE}hellovalue-of-aworld${TOKEN_C}",
tokenFilter.filter("${NOPE}hello${TOKEN_A}world${TOKEN_C}")
"${NOPE}hellovalue-of-aworld${TOKEN_D}",
tokenFilter.filter("${NOPE}hello${TOKEN_A}world${TOKEN_D}")
);
assertEquals(
"Value-of-C",
tokenFilter.filter("${TOKEN_C}")
);
assertEquals(
"value-of-c",
tokenFilter.filter("${TOKEN_C:lower}")
);
assertEquals(
"VALUE-OF-C",
tokenFilter.filter("${TOKEN_C:upper}")
);
}