@Override
  public boolean checkClass(ClassResolver classResolver, String className) {
    try {
      lock.readLock().lock();
      return check(className);
    } finally {
      lock.readLock().unlock();
    }
  }
@Test
  public void testCheckClass() {
    {
      Fury fury = Fury.builder().requireClassRegistration(false).build();
      AllowListChecker checker = new AllowListChecker(AllowListChecker.CheckLevel.STRICT);
      fury.getClassResolver().setClassChecker(checker);
      assertThrows(InsecureException.class, () -> fury.serialize(new AllowListCheckerTest()));
      checker.allowClass(AllowListCheckerTest.class.getName());
      byte[] bytes = fury.serialize(new AllowListCheckerTest());
      checker.addListener(fury.getClassResolver());
      checker.disallowClass(AllowListCheckerTest.class.getName());
      assertThrows(InsecureException.class, () -> fury.serialize(new AllowListCheckerTest()));
      assertThrows(InsecureException.class, () -> fury.deserialize(bytes));
    }
    {
      Fury fury = Fury.builder().requireClassRegistration(false).build();
      AllowListChecker checker = new AllowListChecker(AllowListChecker.CheckLevel.WARN);
      fury.getClassResolver().setClassChecker(checker);
      checker.addListener(fury.getClassResolver());
      byte[] bytes = fury.serialize(new AllowListCheckerTest());
      checker.disallowClass(AllowListCheckerTest.class.getName());
      assertThrows(InsecureException.class, () -> fury.serialize(new AllowListCheckerTest()));
      assertThrows(InsecureException.class, () -> fury.deserialize(bytes));
    }
  }