@SneakyThrows
    private static void test(String filterString) {
        ASN1Element expectedElement = create(filterString).encode();
        byte[] expectedBytes = expectedElement.encode();

        byte[] actualBytes;
        try (BerBuffer buffer = new BerBuffer()) {
            Filter.write(buffer, filterString);
            actualBytes = buffer.getBytes();
        }
        // We encode the sequence in different ways,
        // so we need to normalize their representation.
        com.unboundid.ldap.sdk.Filter filter = decode(ASN1Element.decode(actualBytes));
        ASN1Element actualElement = filter.encode();
        actualBytes = actualElement.encode();

        assertThat(actualBytes).isEqualTo(expectedBytes);
    }
@author James Chen
        <p>
        TODO: Add tests for invalid filters.
turms-gateway/src/test/java/unit/im/turms/gateway/infra/ldap/FilterTest.java