private GuardedObject(String key) {
        this.key = key;
    }
@Test
    void testGuardedObject() throws InterruptedException {
        String key = "testKey";
        GuardedObject<String> guardedObject = GuardedObject.create(key);

        // 启动一个异步线程，模拟事件触发
        new Thread(() -> {
            try {
                Thread.sleep(500); // 模拟异步操作
                GuardedObject.fireEvent(key, "TestEvent");
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }).start();

        // 在主线程中等待事件触发
        String result = guardedObject.getAndThrow(obj -> obj != null && obj.startsWith("Test"), 5, java.util.concurrent.TimeUnit.SECONDS);

        // 验证结果
        assertNotNull(result);
        assertTrue(result.startsWith("Test"));
    }