@Test
    public void testFilter() {

        // Create token filter
        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(
            "$${NOPE}hellovalue-of-aworldvalue-of-b${NOT_A_TOKEN}",
            tokenFilter.filter("$$${NOPE}hello${TOKEN_A}world${TOKEN_B}$${NOT_A_TOKEN}")
        );
        
        // Unknown tokens must be interpreted as literals
        assertEquals(
            "${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}")
        );
        
    }
Verifies that token replacement via filter() functions as specified.
guacamole-ext/src/test/java/org/apache/guacamole/token/TokenFilterTest.java