Skip to content

Commit 3e1b998

Browse files
committed
OperationExecuteIntegrationTest.kt modernized
1 parent b1b107f commit 3e1b998

File tree

5 files changed

+253
-239
lines changed

5 files changed

+253
-239
lines changed

firebase-dataconnect/androidTestutil/src/main/kotlin/com/google/firebase/dataconnect/testutil/DataConnectIntegrationTestBase.kt

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,31 @@ abstract class DataConnectIntegrationTestBase {
4040

4141
val rs: RandomSource by randomSeedTestRule.rs
4242

43+
/**
44+
* Generates and returns a string containing random alphanumeric characters, including the name of
45+
* the currently-running test as returned from [testName].
46+
*
47+
* @param string The [Arb] to use to generate the random string; if not specified, then an [Arb]
48+
* that generates strings of 20 alphanumeric characters is used.
49+
* @param prefix A prefix to include in the returned string; if null (the default) then no prefix
50+
* will be included.
51+
* @return a string containing random characters and incorporating the other information
52+
* identified above.
53+
*/
54+
fun Arb.Companion.alphanumericString(
55+
string: Arb<String> = Arb.string(20, Codepoint.alphanumeric()),
56+
prefix: String? = null,
57+
): Arb<String> = arbitrary {
58+
buildString {
59+
if (prefix != null) {
60+
append(prefix)
61+
}
62+
append(testName)
63+
append("_")
64+
append(string.bind())
65+
}
66+
}
67+
4368
companion object {
4469
val testConnectorConfig: ConnectorConfig
4570
get() =

0 commit comments

Comments
 (0)