2025-12-16 14:37:16 +08:00
|
|
|
package com.tuoheng.machine;
|
|
|
|
|
|
|
|
|
|
import com.tuoheng.machine.platform.PlatformType;
|
|
|
|
|
import com.tuoheng.machine.platform.factory.PlatformStrategyFactory;
|
2025-12-16 16:00:14 +08:00
|
|
|
import com.tuoheng.machine.repository.MachinePlatTypeRepository;
|
2025-12-16 14:37:16 +08:00
|
|
|
import com.tuoheng.machine.service.DrcMachineService;
|
2025-12-16 16:00:14 +08:00
|
|
|
import lombok.extern.slf4j.Slf4j;
|
2025-12-16 14:37:16 +08:00
|
|
|
import org.junit.jupiter.api.Test;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.boot.test.context.SpringBootTest;
|
|
|
|
|
import org.springframework.boot.test.mock.mockito.MockBean;
|
|
|
|
|
|
|
|
|
|
import static org.junit.jupiter.api.Assertions.*;
|
|
|
|
|
import static org.mockito.ArgumentMatchers.anyString;
|
|
|
|
|
import static org.mockito.Mockito.when;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* DRC状态机测试
|
|
|
|
|
* 测试DRC模式的完整状态转换流程
|
|
|
|
|
*/
|
|
|
|
|
@SpringBootTest
|
2025-12-16 16:00:14 +08:00
|
|
|
@Slf4j
|
2025-12-16 14:37:16 +08:00
|
|
|
public class DrcStateMachineTest {
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private DrcMachineService drcMachineService;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private PlatformStrategyFactory platformStrategyFactory;
|
|
|
|
|
|
|
|
|
|
@MockBean
|
2025-12-16 16:00:14 +08:00
|
|
|
private MachinePlatTypeRepository machinePlatTypeRepository;
|
2025-12-16 14:37:16 +08:00
|
|
|
|
|
|
|
|
private static final String TEST_AIRPORT_SN = "test-airport-001";
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 测试 Spring Boot 依赖注入是否正常工作
|
|
|
|
|
*/
|
|
|
|
|
@Test
|
|
|
|
|
public void testAutowiredInjection() {
|
|
|
|
|
|
|
|
|
|
// 验证 PlatformStrategyFactory 是否成功注入
|
|
|
|
|
assertNotNull(platformStrategyFactory, "PlatformStrategyFactory 应该被成功注入");
|
|
|
|
|
// 验证 DrcMachineService 是否成功注入
|
|
|
|
|
assertNotNull(drcMachineService, "DrcMachineService 应该被成功注入");
|
|
|
|
|
// 验证 AirportPlatformRepository Mock 是否成功
|
2025-12-16 16:00:14 +08:00
|
|
|
assertNotNull(machinePlatTypeRepository, "AirportPlatformRepository Mock 应该被成功创建");
|
2025-12-16 14:37:16 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|