parent
23af538733
commit
9f44f30f7d
1 changed files with 7 additions and 7 deletions
|
@ -3,8 +3,8 @@ package app.aaps.plugins.automation.triggers
|
||||||
import app.aaps.plugins.automation.elements.ComparatorConnect
|
import app.aaps.plugins.automation.elements.ComparatorConnect
|
||||||
import com.google.common.truth.Truth.assertThat
|
import com.google.common.truth.Truth.assertThat
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
import org.junit.jupiter.api.Assertions
|
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
|
import org.skyscreamer.jsonassert.JSONAssert
|
||||||
|
|
||||||
class TriggerBTDeviceTest : TriggerTestBase() {
|
class TriggerBTDeviceTest : TriggerTestBase() {
|
||||||
|
|
||||||
|
@ -19,14 +19,14 @@ class TriggerBTDeviceTest : TriggerTestBase() {
|
||||||
@Test fun toJSON() {
|
@Test fun toJSON() {
|
||||||
val t = TriggerBTDevice(injector)
|
val t = TriggerBTDevice(injector)
|
||||||
t.btDevice.value = someName
|
t.btDevice.value = someName
|
||||||
Assertions.assertEquals(btJson, t.toJSON())
|
JSONAssert.assertEquals(btJson, t.toJSON(), true)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun fromJSON() {
|
fun fromJSON() {
|
||||||
val t2 = TriggerDummy(injector).instantiate(JSONObject(btJson)) as TriggerBTDevice
|
val t2 = TriggerDummy(injector).instantiate(JSONObject(btJson)) as TriggerBTDevice
|
||||||
Assertions.assertEquals(ComparatorConnect.Compare.ON_CONNECT, t2.comparator.value)
|
assertThat(t2.comparator.value).isEqualTo(ComparatorConnect.Compare.ON_CONNECT)
|
||||||
Assertions.assertEquals("Headset", t2.btDevice.value)
|
assertThat(t2.btDevice.value).isEqualTo("Headset")
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -40,7 +40,7 @@ class TriggerBTDeviceTest : TriggerTestBase() {
|
||||||
it.btDevice.value = someName
|
it.btDevice.value = someName
|
||||||
}
|
}
|
||||||
val t1 = t.duplicate() as TriggerBTDevice
|
val t1 = t.duplicate() as TriggerBTDevice
|
||||||
Assertions.assertEquals("Headset", t1.btDevice.value)
|
assertThat(t1.btDevice.value).isEqualTo("Headset")
|
||||||
Assertions.assertEquals(ComparatorConnect.Compare.ON_DISCONNECT, t.comparator.value)
|
assertThat(t.comparator.value).isEqualTo(ComparatorConnect.Compare.ON_DISCONNECT)
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue