|
|
|
|
@ -1,5 +1,5 @@
@@ -1,5 +1,5 @@
|
|
|
|
|
/* |
|
|
|
|
* Copyright 2017-2025 the original author or authors. |
|
|
|
|
* Copyright 2025 the original author or authors. |
|
|
|
|
* |
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
|
* you may not use this file except in compliance with the License. |
|
|
|
|
@ -17,7 +17,7 @@ package org.springframework.data.mongodb.core
@@ -17,7 +17,7 @@ package org.springframework.data.mongodb.core
|
|
|
|
|
|
|
|
|
|
import io.mockk.mockk |
|
|
|
|
import io.mockk.verify |
|
|
|
|
import org.junit.Test |
|
|
|
|
import org.junit.jupiter.api.Test |
|
|
|
|
import org.springframework.data.mongodb.core.query.Criteria |
|
|
|
|
import org.springframework.data.mongodb.core.query.Query |
|
|
|
|
import org.springframework.data.mongodb.core.query.Update |
|
|
|
|
@ -25,6 +25,7 @@ import org.springframework.data.mongodb.core.query.UpdateDefinition
@@ -25,6 +25,7 @@ import org.springframework.data.mongodb.core.query.UpdateDefinition
|
|
|
|
|
import org.springframework.data.util.Pair.of |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Unit tests for BulkOperationExtensions. |
|
|
|
|
* @author 2tsumo-hitori |
|
|
|
|
*/ |
|
|
|
|
class BulkOperationExtensionsTests { |
|
|
|
|
@ -32,7 +33,8 @@ class BulkOperationExtensionsTests {
@@ -32,7 +33,8 @@ class BulkOperationExtensionsTests {
|
|
|
|
|
private val bulkOperation = mockk<BulkOperations>(relaxed = true) |
|
|
|
|
|
|
|
|
|
@Test // GH-4911 |
|
|
|
|
fun `BulkOperation#updateMulti#updates() using kotlin#Pair should call its Java counterpart`() { |
|
|
|
|
fun `BulkOperation#updateMulti using kotlin#Pair should call its Java counterpart`() { |
|
|
|
|
|
|
|
|
|
val list: MutableList<Pair<Query, UpdateDefinition>> = mutableListOf() |
|
|
|
|
list.add(where("value", "v2") to set("value", "v3")) |
|
|
|
|
|
|
|
|
|
@ -43,7 +45,8 @@ class BulkOperationExtensionsTests {
@@ -43,7 +45,8 @@ class BulkOperationExtensionsTests {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Test // GH-4911 |
|
|
|
|
fun `BulkOperation#upsert#updates() using kotlin#Pair should call its Java counterpart`() { |
|
|
|
|
fun `BulkOperation#upsert using kotlin#Pair should call its Java counterpart`() { |
|
|
|
|
|
|
|
|
|
val list: MutableList<Pair<Query, Update>> = mutableListOf() |
|
|
|
|
list.add(where("value", "v2") to set("value", "v3")) |
|
|
|
|
|
|
|
|
|
@ -54,7 +57,8 @@ class BulkOperationExtensionsTests {
@@ -54,7 +57,8 @@ class BulkOperationExtensionsTests {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Test // GH-4911 |
|
|
|
|
fun `BulkOperation#updateOne#updates() using kotlin#Pair should call its Java counterpart`() { |
|
|
|
|
fun `BulkOperation#updateOne using kotlin#Pair should call its Java counterpart`() { |
|
|
|
|
|
|
|
|
|
val list: MutableList<Pair<Query, UpdateDefinition>> = mutableListOf() |
|
|
|
|
list.add(where("value", "v2") to set("value", "v3")) |
|
|
|
|
|
|
|
|
|
@ -71,4 +75,5 @@ class BulkOperationExtensionsTests {
@@ -71,4 +75,5 @@ class BulkOperationExtensionsTests {
|
|
|
|
|
private fun set(field: String, value: String): Update { |
|
|
|
|
return Update().set(field, value) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |