package com.zy.integration.iot; import com.zy.iot.config.IotProperties; import com.zy.iot.util.IotInstructionIdGenerator; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; public class IotSupportTest { @Test public void shouldResolveServerUriAndClientId() { IotProperties properties = new IotProperties(); properties.setEndpoint("example-ats.iot.cn-north-1.amazonaws.com.cn"); properties.setPort(8883); properties.setThingName("thing-a"); Assertions.assertEquals("ssl://example-ats.iot.cn-north-1.amazonaws.com.cn:8883", properties.getServerUri()); Assertions.assertEquals("thing-a", properties.getResolvedClientId()); properties.setClientId("client-b"); Assertions.assertEquals("client-b", properties.getResolvedClientId()); } @Test public void shouldGenerateStableLengthInstructionId() { String instructionId = IotInstructionIdGenerator.generate("wrk-1001"); Assertions.assertEquals(20, instructionId.length()); Assertions.assertEquals(instructionId, instructionId.toUpperCase()); } }