JourneyServiceTest.java 1.29 KB
package cn.com.glsx.stdinterface.modules.service;

import cn.com.glsx.Application;
import cn.com.glsx.stdinterface.dto.DeviceJourneyDTO;
import lombok.extern.slf4j.Slf4j;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import java.util.Date;

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

/**
 * @author xiangyanlin
 * @date 2022/4/20
 */
@Slf4j
@RunWith(SpringRunner.class)
@SpringBootTest(classes = Application.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
public class JourneyServiceTest {

    @Autowired
    private JourneyService journeyService;

    @Test
    public void testSave() {
        DeviceJourneyDTO deviceJourneyDTO = new DeviceJourneyDTO();
        deviceJourneyDTO.setSn("1510112899");
        deviceJourneyDTO.setBeginTime(new Date());
        deviceJourneyDTO.setBeginTime(new Date());
        deviceJourneyDTO.setBeginAddress("{\"lat\":\"22.590676\",\"lng\":\"113.987488\"}");
        deviceJourneyDTO.setEndAddress("{\"lat\":\"22.590884\",\"lng\":\"113.988520\"}");
        deviceJourneyDTO.setMileage(7111);
        journeyService.saveDeviceJourney(deviceJourneyDTO);
    }

}