Rewrites ProfileStoreTest with matchers

Issue #2745
This commit is contained in:
Ryan Haining 2023-09-19 22:28:55 -07:00
parent 7f1ba7e763
commit d90db860f0

View file

@ -1,47 +1,47 @@
package info.nightscout.implementation.profile package info.nightscout.implementation.profile
import com.google.common.truth.Truth.assertThat
import info.nightscout.interfaces.profile.PureProfile import info.nightscout.interfaces.profile.PureProfile
import info.nightscout.sharedtests.TestBaseWithProfile import info.nightscout.sharedtests.TestBaseWithProfile
import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.Test import org.junit.jupiter.api.Test
internal class ProfileStoreTest : TestBaseWithProfile() { internal class ProfileStoreTest : TestBaseWithProfile() {
@Test @Test
fun getStartDateTest() { fun getStartDateTest() {
Assertions.assertEquals(0, getValidProfileStore().getStartDate()) assertThat(getValidProfileStore().getStartDate()).isEqualTo(0)
} }
@Test @Test
fun getDefaultProfileTest() { fun getDefaultProfileTest() {
Assertions.assertTrue(getValidProfileStore().getDefaultProfile() is PureProfile) assertThat(getValidProfileStore().getDefaultProfile()).isInstanceOf(PureProfile::class.java)
} }
@Test @Test
fun getDefaultProfileJsonTest() { fun getDefaultProfileJsonTest() {
Assertions.assertTrue(getValidProfileStore().getDefaultProfileJson()?.has("dia") ?: false) assertThat(getValidProfileStore().getDefaultProfileJson()?.has("dia")).isTrue()
Assertions.assertEquals(null, getInvalidProfileStore2().getDefaultProfileJson()) assertThat(getInvalidProfileStore2().getDefaultProfileJson()).isNull()
} }
@Test @Test
fun getDefaultProfileNameTest() { fun getDefaultProfileNameTest() {
Assertions.assertEquals(TESTPROFILENAME, getValidProfileStore().getDefaultProfileName()) assertThat(getValidProfileStore().getDefaultProfileName()).isEqualTo(TESTPROFILENAME)
} }
@Test @Test
fun getProfileListTest() { fun getProfileListTest() {
Assertions.assertEquals(1, getValidProfileStore().getProfileList().size) assertThat(getValidProfileStore().getProfileList()).hasSize(1)
} }
@Test @Test
fun getSpecificProfileTest() { fun getSpecificProfileTest() {
Assertions.assertTrue(getValidProfileStore().getSpecificProfile(TESTPROFILENAME) is PureProfile) assertThat(getValidProfileStore().getSpecificProfile(TESTPROFILENAME)).isInstanceOf(PureProfile::class.java)
} }
@Test @Test
fun allProfilesValidTest() { fun allProfilesValidTest() {
Assertions.assertTrue(getValidProfileStore().allProfilesValid) assertThat(getValidProfileStore().allProfilesValid).isTrue()
Assertions.assertFalse(getInvalidProfileStore1().allProfilesValid) assertThat(getInvalidProfileStore1().allProfilesValid).isFalse()
Assertions.assertFalse(getInvalidProfileStore2().allProfilesValid) assertThat(getInvalidProfileStore2().allProfilesValid).isFalse()
} }
} }