package cn.axzo.msg.center.message.service.youmeng;

import cn.axzo.msg.center.MsgCenterApplication;
import cn.axzo.msg.center.service.enums.TerminalTypeEnum;
import com.google.common.util.concurrent.Uninterruptibles;
import lombok.RequiredArgsConstructor;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;

import java.util.Collections;
import java.util.concurrent.TimeUnit;

import static org.junit.jupiter.api.Assertions.*;

/**
 * @author yanglin
 */
@SpringBootTest(classes = MsgCenterApplication.class)
@RequiredArgsConstructor(onConstructor_ = @Autowired)
class YoumengTemplateClientTest {

    private final YoumengTemplateClient youmengTemplateClient;

    @Test
    void foo() {
        YoumengPush push = new YoumengPush();
        push.setTitle("aaa");
        push.setContent("bbb");
        push.setReceiverOuId(3L);
        push.setReceiverPersonId(444L);
        YoumengPush.PushNavigation navigation = new YoumengPush.PushNavigation();
        navigation.setUrl("test_url");
        navigation.setPlatform(TerminalTypeEnum.ANDROID);
        push.setNavigations(Collections.singletonList(navigation));
        youmengTemplateClient.syncSend(590L, Collections.singletonList(push));
        Uninterruptibles.sleepUninterruptibly(1, TimeUnit.MINUTES);
    }

}