Replaces FunctionsTest assertThrows with assertFailsWith
Related to #2745
This commit is contained in:
parent
80011759f5
commit
88c38b8049
|
@ -1,9 +1,10 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.dash.util
|
||||
|
||||
import com.google.common.truth.Truth.assertThat
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition.BasalProgram
|
||||
import info.nightscout.interfaces.profile.Profile
|
||||
import info.nightscout.interfaces.profile.Profile.ProfileValue
|
||||
import org.junit.Assert
|
||||
import kotlin.test.assertFailsWith
|
||||
import org.junit.jupiter.api.Assertions
|
||||
import org.junit.jupiter.api.Test
|
||||
import org.mockito.Mockito
|
||||
|
@ -44,12 +45,10 @@ class FunctionsTest {
|
|||
|
||||
`when`(profile.getBasalValues()).thenReturn(emptyArray())
|
||||
|
||||
Assert.assertThrows(
|
||||
"Basal values should contain values",
|
||||
java.lang.IllegalArgumentException::class.java
|
||||
) {
|
||||
val exception = assertFailsWith<IllegalArgumentException> {
|
||||
mapProfileToBasalProgram(profile)
|
||||
}
|
||||
assertThat(exception.message).isEqualTo("Basal values should contain values")
|
||||
}
|
||||
|
||||
@Test fun invalidProfileNonZeroOffset() {
|
||||
|
@ -59,12 +58,10 @@ class FunctionsTest {
|
|||
arrayOf(ProfileValue(1800, 0.5))
|
||||
)
|
||||
|
||||
Assert.assertThrows(
|
||||
"First basal segment start time should be 0",
|
||||
java.lang.IllegalArgumentException::class.java
|
||||
) {
|
||||
val exception = assertFailsWith<IllegalArgumentException> {
|
||||
mapProfileToBasalProgram(profile)
|
||||
}
|
||||
assertThat(exception.message).isEqualTo("First basal segment start time should be 0")
|
||||
}
|
||||
|
||||
@Test fun invalidProfileMoreThan24Hours() {
|
||||
|
@ -77,12 +74,10 @@ class FunctionsTest {
|
|||
)
|
||||
)
|
||||
|
||||
Assert.assertThrows(
|
||||
"Basal segment start time can not be greater than 86400",
|
||||
java.lang.IllegalArgumentException::class.java
|
||||
) {
|
||||
val exception = assertFailsWith<IllegalArgumentException> {
|
||||
mapProfileToBasalProgram(profile)
|
||||
}
|
||||
assertThat(exception.message).isEqualTo("Basal segment start time can not be greater than 86400")
|
||||
}
|
||||
|
||||
@Test fun invalidProfileNegativeOffset() {
|
||||
|
@ -92,9 +87,10 @@ class FunctionsTest {
|
|||
arrayOf(ProfileValue(-1, 0.5))
|
||||
)
|
||||
|
||||
Assert.assertThrows("Basal segment start time can not be less than 0", IllegalArgumentException::class.java) {
|
||||
val exception = assertFailsWith<IllegalArgumentException> {
|
||||
mapProfileToBasalProgram(profile)
|
||||
}
|
||||
assertThat(exception.message).isEqualTo("Basal segment start time can not be less than 0")
|
||||
}
|
||||
|
||||
@Test fun roundsToSupportedPrecision() {
|
||||
|
|
Loading…
Reference in a new issue