package org.dromara.mqtt;

import org.dromara.mqtt.config.properties.MqttProperties;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;

import static org.assertj.core.api.Assertions.assertThat;
import static org.springframework.test.util.ReflectionTestUtils.invokeMethod;

@Tag("dev")
class DeviceMqttCommandPublisherTest {

    @Test
    void buildCommandTopicDefaultsToDeviceNo() {
        MqttProperties properties = new MqttProperties();
        DeviceMqttCommandPublisher publisher = new DeviceMqttCommandPublisher(
            null,
            null,
            properties
        );

        String topic = invokeMethod(publisher, "buildCommandTopic", "D01");

        assertThat(topic).isEqualTo("/d01/subscriber/cmd");
    }
}
