Rewrites InputDurationTest with matchers

Issue #2745
This commit is contained in:
Ryan Haining 2023-10-04 21:06:47 -07:00
parent 38c01372ee
commit 59215f03e5

View file

@ -1,20 +1,20 @@
package app.aaps.plugins.automation.elements package app.aaps.plugins.automation.elements
import app.aaps.plugins.automation.triggers.TriggerTestBase import app.aaps.plugins.automation.triggers.TriggerTestBase
import org.junit.jupiter.api.Assertions import com.google.common.truth.Truth.assertThat
import org.junit.jupiter.api.Test import org.junit.jupiter.api.Test
class InputDurationTest : TriggerTestBase() { class InputDurationTest : TriggerTestBase() {
@Test fun setValueTest() { @Test fun setValueTest() {
var i = InputDuration(5, InputDuration.TimeUnit.MINUTES) var i = InputDuration(5, InputDuration.TimeUnit.MINUTES)
Assertions.assertEquals(5, i.value) assertThat(i.value).isEqualTo(5)
Assertions.assertEquals(InputDuration.TimeUnit.MINUTES, i.unit) assertThat(i.unit).isEqualTo(InputDuration.TimeUnit.MINUTES)
i = InputDuration(5, InputDuration.TimeUnit.HOURS) i = InputDuration(5, InputDuration.TimeUnit.HOURS)
Assertions.assertEquals(5, i.value) assertThat(i.value).isEqualTo(5)
Assertions.assertEquals(InputDuration.TimeUnit.HOURS, i.unit) assertThat(i.unit).isEqualTo(InputDuration.TimeUnit.HOURS)
Assertions.assertEquals(5 * 60, i.getMinutes()) assertThat(i.getMinutes()).isEqualTo(5 * 60)
i.setMinutes(60) i.setMinutes(60)
Assertions.assertEquals(1, i.value) assertThat(i.value).isEqualTo(1)
} }
} }