//package com.renrenliao.model.repository
//
//import com.renrenliao.im.http.RetrofitClient
//import com.renrenliao.im.model.api.ApiService
//import com.renrenliao.im.utils.MapUtils
//import kotlinx.coroutines.Dispatchers
//import kotlinx.coroutines.launch
//import kotlinx.coroutines.newSingleThreadContext
//import kotlinx.coroutines.runBlocking
//import kotlinx.coroutines.test.resetMain
//import kotlinx.coroutines.test.setMain
//import org.junit.After
//import org.junit.Before
//import org.junit.Test
//
////
////
////
////import com.combodia.httplib.factory.RetrofitClient
////import com.jony.farm.config.Const
////import com.jony.farm.model.api.ServiceApi
////import com.jony.farm.util.MapUtils
////import kotlinx.coroutines.Dispatchers
////import kotlinx.coroutines.launch
////import kotlinx.coroutines.runBlocking
////import kotlinx.coroutines.test.TestCoroutineDispatcher
////import kotlinx.coroutines.test.setMain
////import org.junit.After
////import org.junit.Before
////import org.junit.Test
////
////
//class ServiceApiTest {
//  //  val BASE_URL = "http://127.0.0.1/"
//    val BASE_URL = "http://10.3.3.8/"
//  //  val BASE_URL = "https://www.wanandroid.com/"
//    //  private val testDispatcher = TestCoroutineDispatcher()
//    private val mainThreadSurrogate = newSingleThreadContext("UI thread")
//    private val serviceApi = RetrofitClient.createApi(ApiService::class.java, BASE_URL)
//
//    @Before
//    fun setUp() {
//        Dispatchers.setMain(mainThreadSurrogate)
//
//    }
//
//    @After
//    fun tearDown() {
//        Dispatchers.resetMain() // reset the main dispatcher to the original Main dispatcher
//        mainThreadSurrogate.close()
//
//    }
//
//
//    @Test
//    fun testSomeUI() = runBlocking <Unit>{
//        launch(Dispatchers.Main) {  // Will be launched in the mainThreadSurrogate dispatcher
//            println("xasds")
//        }
//    }
//
//
//    @Test
//    fun login() = runBlocking <Unit>{
//        val map = HashMap<String,String>()
//        map["userName"] = "ganzhe"
//        map["password"] = "gz123456"
//        map["loginType"] = "1"
//        map["umDeviceToken"] = ""
//        map["modleType"] = "android"
//        map["loginId"] = ""
//        map["userUid"] = ""
//
//
//        launch (Dispatchers.IO){
//            val body = MapUtils.map2JsonRequestBody(map)
//            val result = serviceApi.login(body)
//       //     val json = Des3Util.decode(result.data)
//            println(result)
//        }
//    }
//
//    @Test
//    fun test()= runBlocking <Unit>{
//        val url = "api/config/appConfig"
//        val map = HashMap<String,String>()
//        map["type"] = "0"
//        map["version"] = "1"
//        val body = MapUtils.map2JsonRequestBody(map)
//        launch (Dispatchers.IO){
//            val result = serviceApi.test(map)
//            println(result.data)
//        }
//    }
//
//    @Test
//    fun test1() = runBlocking <Unit>{
//        val url = "https://myimconf.oss-cn-shanghai.aliyuncs.com/test/servernode.json"
//        launch(Dispatchers.IO){
//            val result = serviceApi.test1(url)
//            println(result)
//        }
//    }
//
//
//}