云
9 小时以前 95ae0c83d2aa58d86b4039e3f7f16ee93afb8f00
yudao-module-mdm/src/test/java/cn/iocoder/yudao/module/mdm/service/agent/MdmAgentImportCommandServiceTest.java
@@ -49,7 +49,7 @@
    @Mock private PlatformTransactionManager transactionManager;
    @InjectMocks private MdmAgentImportCommandService service;
    private final AgentPrincipal principal = new AgentPrincipal(7L, 0L, "live");
    private final AgentPrincipal principal = new AgentPrincipal(7L, "live");
    @BeforeEach
    void setUp() {
@@ -81,7 +81,7 @@
        AtomicReference<MdmAgentImportCommandDO> inserted = captureInsertedCommand();
        MdmAgentImportReceiptRespVO first = service.commit(request("物料A"), principal);
        when(commandMapper.selectByCommandId(0L, 7L, "cmd-1")).thenReturn(inserted.get());
        when(commandMapper.selectByCommandId(7L, "cmd-1")).thenReturn(inserted.get());
        MdmAgentImportReceiptRespVO second = service.commit(request("物料A"), principal);
        assertEquals("SUCCEEDED", first.getStatus());
@@ -95,8 +95,8 @@
        when(preflightService.preflight(any(), any())).thenReturn(preflight(PREFLIGHT_HASH));
        AtomicReference<MdmAgentImportCommandDO> inserted = captureInsertedCommand();
        service.commit(request("物料A"), principal);
        when(commandMapper.selectByCommandId(0L, 7L, "cmd-1")).thenReturn(inserted.get());
        when(commandMapper.selectByIdempotencyKey(0L, 7L, "idem-1")).thenReturn(null);
        when(commandMapper.selectByCommandId(7L, "cmd-1")).thenReturn(inserted.get());
        when(commandMapper.selectByIdempotencyKey(7L, "idem-1")).thenReturn(null);
        AgentBridgeException ex = assertThrows(AgentBridgeException.class,
                () -> service.commit(request("物料B"), principal));
@@ -115,7 +115,7 @@
    @Test
    void missingCommandReturnsNotFound() {
        when(commandMapper.selectByCommandId(0L, 7L, "cmd-x")).thenReturn(null);
        when(commandMapper.selectByCommandId(7L, "cmd-x")).thenReturn(null);
        AgentBridgeException ex = assertThrows(AgentBridgeException.class,
                () -> service.getCommand("cmd-x", principal));