public void check(Metadata metadata) throws AccessPermissionException {
        if (!needToCheck) {
            return;
        }
        if ("false".equals(metadata.get(AccessPermissions.EXTRACT_CONTENT))) {
            if (allowExtractionForAccessibility) {
                if ("true".equals(metadata.get(AccessPermissions.EXTRACT_FOR_ACCESSIBILITY))) {
                    return;
                }
                throw new AccessPermissionException(
                        "Content extraction for accessibility is not allowed.");
            }
            throw new AccessPermissionException("Content extraction is not allowed.");
        }
    }
@Test
    public void testLegacy() throws AccessPermissionException {
        //test that there are no thrown exceptions
        Metadata m = getMetadata(false, false);
        //legacy behavior; don't bother checking
        AccessChecker checker = new AccessChecker();
        checker.check(m);

        m = getMetadata(false, true);
        checker.check(m);

        m = getMetadata(true, true);
        checker.check(m);
    }