Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8.14 Half of Replicator Tests #116

Merged
merged 3 commits into from
Sep 1, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
8.14 Half of Replicator Tests
  • Loading branch information
LaurenNguyen14 committed Aug 31, 2022
commit 0b2dcd074f928a0a3676c3d63b65950bab26613b
9 changes: 9 additions & 0 deletions common/test/java/com/couchbase/lite/BaseCollectionTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,15 @@ open class BaseCollectionTest : BaseDbTest() {
assertEquals(n.toLong(), testCollection.count)
}

protected fun createDocsInCustomizedCollection(n: Int, col: Collection) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this just createDocsInCollection?

for (i in 0 until n) {
val doc = MutableDocument(String.format(Locale.US, "%s_%s_doc_%03d", col.database.name, col.name, i))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no need to do this, in Kotlin. I think you probably copy/pasted it from somewhere. In Kotlin, all you need is: "${col.database.name}${col.name}${i}". Just be sure you do that everywhere!

doc.setValue("key", i)
saveDocInCollection(doc, col)
}
assertEquals(n.toLong(), col.count)
}

@Throws(IOException::class, JSONException::class)
protected fun loadJSONResourceIntoCollection(name: String, collection: Collection) {
BufferedReader(InputStreamReader(PlatformUtils.getAsset(name))).use {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public void awaitAndValidate() {
}
}

public abstract class BaseReplicatorTest extends BaseDbTest {
public abstract class BaseReplicatorTest extends BaseCollectionTest {

// Don't let the NetworkConnectivityManager confuse tests
public static Replicator testReplicator(ReplicatorConfiguration config) { return new Replicator(null, config); }
Expand Down