Rewrites StorageConstraintPluginTest with matchers

Issue #2745
This commit is contained in:
Ryan Haining 2023-09-23 17:58:52 -07:00
parent 71237a633c
commit 99c042fb65

View file

@ -1,13 +1,13 @@
package info.nightscout.plugins.constraints.storage
import app.aaps.shared.tests.TestBase
import com.google.common.truth.Truth.assertThat
import dagger.android.AndroidInjector
import dagger.android.HasAndroidInjector
import info.nightscout.core.constraints.ConstraintObject
import info.nightscout.interfaces.ui.UiInteraction
import info.nightscout.rx.logging.AAPSLogger
import info.nightscout.shared.interfaces.ResourceHelper
import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test
import org.mockito.Mock
@ -42,9 +42,9 @@ class StorageConstraintPluginTest : TestBase() {
val mocked = MockedStorageConstraintPlugin({ AndroidInjector { } }, aapsLogger, rh, uiInteraction)
// Set free space under 200(Mb) to disable loop
mocked.memSize = 150L
Assertions.assertEquals(false, mocked.isClosedLoopAllowed(ConstraintObject(true, aapsLogger)).value())
assertThat(mocked.isClosedLoopAllowed(ConstraintObject(true, aapsLogger)).value()).isFalse()
// Set free space over 200(Mb) to enable loop
mocked.memSize = 300L
Assertions.assertEquals(true, mocked.isClosedLoopAllowed(ConstraintObject(true, aapsLogger)).value())
assertThat(mocked.isClosedLoopAllowed(ConstraintObject(true, aapsLogger)).value()).isTrue()
}
}