支持通话快照、同步和反向拨号
This commit is contained in:
1 parent
5381d2b631
commit
f71f696158
8 files changed
+266
No files matched your search
@@ -0,0 +1,32 @@
|
||||
package com.youlai.boot.device;
|
||||
|
||||
import com.youlai.boot.common.exception.BusinessException;
|
||||
import com.youlai.boot.common.result.Result;
|
||||
import com.youlai.boot.device.service.CallSyncRegistry;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
import static org.junit.jupiter.api.Assertions.assertSame;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
|
||||
class CallSyncRegistryTest {
|
||||
|
||||
@Test
|
||||
void onlyMatchingDeviceAndRequestCanCompleteTheWait() {
|
||||
CallSyncRegistry registry = new CallSyncRegistry();
|
||||
var first = registry.register("device-a", "first");
|
||||
Result<Void> success = Result.success();
|
||||
|
||||
assertThrows(BusinessException.class, () -> registry.register("device-a", "duplicate"));
|
||||
registry.complete("device-b", "first", success);
|
||||
registry.complete("device-a", "unrelated", success);
|
||||
assertFalse(first.hasResult());
|
||||
|
||||
registry.complete("device-a", "first", success);
|
||||
assertSame(success, first.getResult());
|
||||
|
||||
var second = registry.register("device-a", "second");
|
||||
registry.complete("device-a", "first", success);
|
||||
assertFalse(second.hasResult());
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user