riku
2019-09-17 2bf337ab074f1c047c4f4e4df29ed994d3decaf1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package com.flightfeather.obd
 
import com.flightfeather.obd.domain.mapper.ObdDataMapper
import com.flightfeather.obd.lightshare.bean.BaseJson
import com.flightfeather.obd.lightshare.bean.ObdDataVo
import com.google.gson.Gson
import org.junit.Test
import org.junit.runner.RunWith
import org.slf4j.LoggerFactory
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.boot.test.context.SpringBootTest
import org.springframework.test.context.junit4.SpringRunner
 
@RunWith(SpringRunner::class)
@SpringBootTest
class ObdApplicationTests {
 
    @Autowired
    lateinit var obdDataMapper: ObdDataMapper
 
    @Test
    fun contextLoads() {
    }
 
    @Test
    fun foo1(): Unit {
//        val map = GsonJsonParser().parseMap("{\"vin\":\"vin001\",\"protocol\":2}")
        val map = Gson().fromJson("{\"vin\":\"vin001\",\"protocol\":2,\"cmdCode\":2001}", ObdDataVo::class.java)
        val res = obdDataMapper.selectAll()
        res.forEach {
            println(it.obdVin)
            println(it.obdTime)
        }
        println(map.obdVin)
        println(map.obdProtocol)
        println(map.cmdCode)
    }
 
    @Test
    fun logTest() {
        val log = LoggerFactory.getLogger(javaClass)
        log.trace("trace")
        log.debug("debug")
        log.warn("warn")
        log.info("info")
        log.error("error")
    }
 
}