package com.nokia.sms.service;

import java.util.Date;

import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;

import com.nokia.sms.pojo.Sms;

@SpringBootTest
public class SmsServiceTest {
    @Autowired
    private SgipSmsService service;

    // 测试批量发送
    @Test
    public void test() {
        Sms sms = new Sms();
        sms.setPhoneNumbers(new String[] { "13231899751", "18631181961", "18031151219", "15633560090", "15996582933" });
        sms.setContent("这是一条测试短信--" + new Date());
        System.out.println(service.sendMessage(sms));
    }

    // 测试定时发送
    @Test
    public void test2() {
        Sms sms = new Sms();
        sms.setFromSystem("测试");
        sms.setPhoneNumbers(new String[] { "13231899751" });
        sms.setContent("这是一条测试短信--" + new Date());
        // 5分钟后发送
        sms.setScheduleTime(new Date(System.currentTimeMillis() + 5 * 60 * 1000));
        System.out.println(service.sendMessage(sms));
    }
}
