Rewrites PairTest with matchers

Issue #2745
This commit is contained in:
Ryan Haining 2023-09-08 19:56:43 -07:00
parent 36ce238cc9
commit 89bd176996

View file

@ -1,5 +1,6 @@
package info.nightscout.androidaps.interaction.utils package info.nightscout.androidaps.interaction.utils
import com.google.common.truth.Truth.assertThat
import org.junit.Assert import org.junit.Assert
import org.junit.jupiter.api.Test import org.junit.jupiter.api.Test
@ -34,15 +35,15 @@ class PairTest {
val set: MutableSet<Pair<*, *>> = HashSet() val set: MutableSet<Pair<*, *>> = HashSet()
// THEN // THEN
Assert.assertFalse(set.contains(inserted)) assertThat(set).doesNotContain(inserted)
set.add(inserted) set.add(inserted)
Assert.assertTrue(set.contains(inserted)) assertThat(set).contains(inserted)
} }
@Test fun toStringTest() { @Test fun toStringTest() {
// GIVEN // GIVEN
val pair: Pair<*, *> = Pair.create("the-first", "2nd") val pair: Pair<*, *> = Pair.create("the-first", "2nd")
Assert.assertTrue(pair.toString().contains("the-first")) assertThat(pair.toString()).contains("the-first")
Assert.assertTrue(pair.toString().contains("2nd")) assertThat(pair.toString()).contains("2nd")
} }
} }