@SuppressWarnings("unchecked")
    private void testWhitespaceHandlingHelper(String leading, String embedded, String trailing) throws InvalidSyntaxException {
        // We use a specific dictionary here.
        Dictionary dict = new Hashtable();
        dict.put("a"+embedded+"b", "a");

        String filter = "(" + leading + "a" + embedded + "b" + trailing + "=a)";
        String filterWithoutEmbedded =  "(" + leading + "ab" + trailing + "=a)";

        // Create a human readable representation of what we got, and make sure all
        // characters received are actually whitespace.
        StringBuffer whatDidWeGet = new StringBuffer();
        boolean allValidWhitespace = true;
        whatDidWeGet.append("(leading: ");
        for (char c : leading.toCharArray()) {
            whatDidWeGet.append("character " + (int)c + ", ");
            if (!Character.isWhitespace(c)) {
                allValidWhitespace = false;
            }
        }
        whatDidWeGet.append(" embedded: ");
        for (char c : embedded.toCharArray()) {
            whatDidWeGet.append("character " + (int)c + ", ");
            if (!Character.isWhitespace(c)) {
                allValidWhitespace = false;
            }
        }
        whatDidWeGet.append(" trailing: ");
        for (char c : trailing.toCharArray()) {
            whatDidWeGet.append("character " + (int)c + ", ");
            if (!Character.isWhitespace(c)) {
                allValidWhitespace = false;
            }
        }
        whatDidWeGet.append(")");

        // First test whether the filter is syntactically correct or not, and whether is judged as such.
        try {
            m_context.createFilter(filter).match(dict);
            assert allValidWhitespace : "Whitespace placeholders contain non-whitespace characters, but is allowed. " + whatDidWeGet;
        }
        catch (InvalidSyntaxException e) {
            assert !allValidWhitespace : "Whitespace placeholders contain all valid whitespace characters, but is not allowed. " + whatDidWeGet;
        }

        // If the filter does not contain illegal whitespaces, check whether the dictionary handles it correctly.
        if (allValidWhitespace) {
            assert m_context.createFilter(filter).match(dict) : "Embedded whitespace should be honored, leading and trailing ignored. " + whatDidWeGet;

            if (embedded.length() > 0) {
                assert !m_context.createFilter(filterWithoutEmbedded).match(dict) : "Embedded whitespace is significant." + whatDidWeGet;
            }
        }
    }