parent
99b959229a
commit
260d877e1d
|
@ -3,11 +3,12 @@ package app.aaps.plugins.automation.actions
|
|||
import app.aaps.core.interfaces.queue.Callback
|
||||
import app.aaps.plugins.automation.R
|
||||
import app.aaps.plugins.automation.elements.InputString
|
||||
import org.junit.jupiter.api.Assertions
|
||||
import com.google.common.truth.Truth.assertThat
|
||||
import org.junit.jupiter.api.BeforeEach
|
||||
import org.junit.jupiter.api.Test
|
||||
import org.mockito.ArgumentMatchers.anyString
|
||||
import org.mockito.Mockito.`when`
|
||||
import org.skyscreamer.jsonassert.JSONAssert
|
||||
|
||||
class ActionSendSMSTest : ActionsTestBase() {
|
||||
|
||||
|
@ -23,15 +24,15 @@ class ActionSendSMSTest : ActionsTestBase() {
|
|||
}
|
||||
|
||||
@Test fun friendlyNameTest() {
|
||||
Assertions.assertEquals(R.string.sendsmsactiondescription, sut.friendlyName())
|
||||
assertThat(sut.friendlyName()).isEqualTo(R.string.sendsmsactiondescription)
|
||||
}
|
||||
|
||||
@Test fun shortDescriptionTest() {
|
||||
Assertions.assertEquals("Send SMS: ", sut.shortDescription())
|
||||
assertThat(sut.shortDescription()).isEqualTo("Send SMS: ")
|
||||
}
|
||||
|
||||
@Test fun iconTest() {
|
||||
Assertions.assertEquals(R.drawable.ic_notifications, sut.icon())
|
||||
assertThat(sut.icon()).isEqualTo(R.drawable.ic_notifications)
|
||||
}
|
||||
|
||||
@Test fun doActionTest() {
|
||||
|
@ -39,22 +40,22 @@ class ActionSendSMSTest : ActionsTestBase() {
|
|||
sut.text = InputString("Asd")
|
||||
sut.doAction(object : Callback() {
|
||||
override fun run() {
|
||||
Assertions.assertTrue(result.success)
|
||||
assertThat(result.success).isTrue()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@Test fun hasDialogTest() {
|
||||
Assertions.assertTrue(sut.hasDialog())
|
||||
assertThat(sut.hasDialog()).isTrue()
|
||||
}
|
||||
|
||||
@Test fun toJSONTest() {
|
||||
sut.text = InputString("Asd")
|
||||
Assertions.assertEquals("{\"data\":{\"text\":\"Asd\"},\"type\":\"ActionSendSMS\"}", sut.toJSON())
|
||||
JSONAssert.assertEquals("""{"data":{"text":"Asd"},"type":"ActionSendSMS"}""", sut.toJSON(), true)
|
||||
}
|
||||
|
||||
@Test fun fromJSONTest() {
|
||||
sut.fromJSON("{\"text\":\"Asd\"}")
|
||||
Assertions.assertEquals("Asd", sut.text.value)
|
||||
sut.fromJSON("""{"text":"Asd"}""")
|
||||
assertThat(sut.text.value).isEqualTo("Asd")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue