Skip to content

Commit 890647c

Browse files
committed
ListContainingNullUnitTest.kt: migrate from sampleFromArb() to Arb.next(RandomSource, edgeCaseProbability)
1 parent 3e76503 commit 890647c

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

firebase-dataconnect/testutil/src/test/kotlin/com/google/firebase/dataconnect/testutil/ListContainingNullUnitTest.kt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
package com.google.firebase.dataconnect.testutil
1818

1919
import com.google.firebase.dataconnect.testutil.property.arbitrary.listContainingNull
20-
import com.google.firebase.dataconnect.testutil.property.arbitrary.sampleFromArb
20+
import com.google.firebase.dataconnect.testutil.property.arbitrary.next
2121
import io.kotest.assertions.asClue
2222
import io.kotest.assertions.assertSoftly
2323
import io.kotest.assertions.withClue
@@ -40,8 +40,8 @@ class ListContainingNullUnitTest {
4040
fun `listContainingNull generates values with lengths in the given range`() = runTest {
4141
checkAll(NUM_ITERATIONS, listLengthsArb) { lengthRange ->
4242
val arb = Arb.listContainingNull(valuesGen, lengthRange)
43-
val sample = sampleFromArb(arb, edgeCaseProbability = 0.5)
44-
sample.value.asClue {
43+
val value = arb.next(randomSource(), edgeCaseProbability = 0.5f)
44+
value.asClue {
4545
assertSoftly {
4646
it.size shouldBeGreaterThanOrEqual lengthRange.first
4747
it.size shouldBeLessThanOrEqual lengthRange.last
@@ -54,8 +54,8 @@ class ListContainingNullUnitTest {
5454
fun `listContainingNull generates values from the given arb`() = runTest {
5555
checkAll(NUM_ITERATIONS, listLengthsArb) { lengthRange ->
5656
val arb = Arb.listContainingNull(valuesGen, lengthRange)
57-
val sample = sampleFromArb(arb, edgeCaseProbability = 0.5)
58-
sample.value.asClue {
57+
val value = arb.next(randomSource(), edgeCaseProbability = 0.5f)
58+
value.asClue {
5959
assertSoftly {
6060
it.forEachIndexed { index, value ->
6161
if (value !== null) {
@@ -71,8 +71,8 @@ class ListContainingNullUnitTest {
7171
fun `listContainingNull generates lists that always contain null`() = runTest {
7272
checkAll(NUM_ITERATIONS, listLengthsArb) { lengthRange ->
7373
val arb = Arb.listContainingNull(valuesGen, lengthRange)
74-
val sample = sampleFromArb(arb, edgeCaseProbability = 0.5)
75-
sample.value.asClue { it shouldContain null }
74+
val value = arb.next(randomSource(), edgeCaseProbability = 0.5f)
75+
value.asClue { it shouldContain null }
7676
}
7777
}
7878

0 commit comments

Comments
 (0)