@Test
public void onPublish() throws Exception {

    IPlanExecutor executor = mock(IPlanExecutor.class);
    PayloadFormatter payloadFormat = PayloadFormatManager.getPayloadFormat("json");
    PublishHandler handler = new PublishHandler(executor, payloadFormat);
    String payload = "{\n" +
            "\"device\":\"root.sg.d1\",\n" +
            "\"timestamp\":1586076045524,\n" +
            "\"measurements\":[\"s1\"],\n" +
            "\"values\":[0.530635]\n" +
            "}";
    ByteBuf buf = Unpooled.copiedBuffer(payload, StandardCharsets.UTF_8);
    MqttPublishVariableHeader variableHeader = new MqttPublishVariableHeader("root.sg.d1", 1);
    MqttFixedHeader fixedHeader = new MqttFixedHeader(MqttMessageType.PUBLISH, false, MqttQoS.AT_LEAST_ONCE, false, 1);
    MqttPublishMessage publishMessage = new MqttPublishMessage(fixedHeader, variableHeader, buf);
    InterceptPublishMessage message = new InterceptPublishMessage(publishMessage, null, null);
    handler.onPublish(message);
    verify(executor).processNonQuery(any(InsertRowPlan.class));
}