DATAMONGO-1719 - Polishing.
Use mockito extensions to mimic static imports. Use Lombok's FieldDefaults and NonNull in operations support. Original Pull Request: #487
This commit is contained in:
committed by
Christoph Strobl
parent
4734a2925c
commit
1475cde337
@@ -15,7 +15,10 @@
|
||||
*/
|
||||
package org.springframework.data.mongodb.core;
|
||||
|
||||
import lombok.AccessLevel;
|
||||
import lombok.NonNull;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.experimental.FieldDefaults;
|
||||
|
||||
import org.springframework.data.mongodb.core.aggregation.Aggregation;
|
||||
import org.springframework.data.mongodb.core.aggregation.AggregationResults;
|
||||
@@ -53,7 +56,7 @@ class ExecutableAggregationOperationSupport implements ExecutableAggregationOper
|
||||
|
||||
Assert.notNull(domainType, "DomainType must not be null!");
|
||||
|
||||
return new ExecutableAggregationSupport<>(template, null, domainType, null);
|
||||
return new ExecutableAggregationSupport<>(template, domainType, null, null);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -61,20 +64,21 @@ class ExecutableAggregationOperationSupport implements ExecutableAggregationOper
|
||||
* @since 2.0
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@FieldDefaults(level = AccessLevel.PRIVATE, makeFinal = true)
|
||||
static class ExecutableAggregationSupport<T>
|
||||
implements AggregationWithAggregation<T>, ExecutableAggregation<T>, TerminatingAggregation<T> {
|
||||
|
||||
private final MongoTemplate template;
|
||||
private final Aggregation aggregation;
|
||||
private final Class<T> domainType;
|
||||
private final String collection;
|
||||
@NonNull MongoTemplate template;
|
||||
@NonNull Class<T> domainType;
|
||||
Aggregation aggregation;
|
||||
String collection;
|
||||
|
||||
@Override
|
||||
public AggregationWithAggregation<T> inCollection(String collection) {
|
||||
|
||||
Assert.hasText(collection, "Collection must not be null nor empty!");
|
||||
|
||||
return new ExecutableAggregationSupport<>(template, aggregation, domainType, collection);
|
||||
return new ExecutableAggregationSupport<>(template, domainType, aggregation, collection);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -82,7 +86,7 @@ class ExecutableAggregationOperationSupport implements ExecutableAggregationOper
|
||||
|
||||
Assert.notNull(aggregation, "Aggregation must not be null!");
|
||||
|
||||
return new ExecutableAggregationSupport<>(template, aggregation, domainType, collection);
|
||||
return new ExecutableAggregationSupport<>(template, domainType, aggregation, collection);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -15,7 +15,10 @@
|
||||
*/
|
||||
package org.springframework.data.mongodb.core;
|
||||
|
||||
import lombok.AccessLevel;
|
||||
import lombok.NonNull;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.experimental.FieldDefaults;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
@@ -74,14 +77,15 @@ class ExecutableFindOperationSupport implements ExecutableFindOperation {
|
||||
* @since 2.0
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@FieldDefaults(level = AccessLevel.PRIVATE, makeFinal = true)
|
||||
static class ExecutableFindSupport<T>
|
||||
implements ExecutableFind<T>, FindWithCollection<T>, FindWithProjection<T>, FindWithQuery<T> {
|
||||
|
||||
private final MongoTemplate template;
|
||||
private final Class<?> domainType;
|
||||
private final Class<T> returnType;
|
||||
private final String collection;
|
||||
private final Query query;
|
||||
@NonNull MongoTemplate template;
|
||||
@NonNull Class<?> domainType;
|
||||
Class<T> returnType;
|
||||
String collection;
|
||||
Query query;
|
||||
|
||||
@Override
|
||||
public FindWithProjection<T> inCollection(String collection) {
|
||||
|
||||
@@ -15,11 +15,14 @@
|
||||
*/
|
||||
package org.springframework.data.mongodb.core;
|
||||
|
||||
import lombok.AccessLevel;
|
||||
import lombok.NonNull;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
||||
import lombok.experimental.FieldDefaults;
|
||||
import org.springframework.data.mongodb.core.BulkOperations.BulkMode;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.StringUtils;
|
||||
@@ -63,12 +66,13 @@ class ExecutableInsertOperationSupport implements ExecutableInsertOperation {
|
||||
* @since 2.0
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@FieldDefaults(level = AccessLevel.PRIVATE, makeFinal = true)
|
||||
static class ExecutableInsertSupport<T> implements ExecutableInsert<T> {
|
||||
|
||||
private final MongoTemplate template;
|
||||
private final Class<T> domainType;
|
||||
private final String collection;
|
||||
private final BulkMode bulkMode;
|
||||
@NonNull MongoTemplate template;
|
||||
@NonNull Class<T> domainType;
|
||||
String collection;
|
||||
BulkMode bulkMode;
|
||||
|
||||
@Override
|
||||
public void one(T object) {
|
||||
|
||||
@@ -15,7 +15,10 @@
|
||||
*/
|
||||
package org.springframework.data.mongodb.core;
|
||||
|
||||
import lombok.AccessLevel;
|
||||
import lombok.NonNull;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.experimental.FieldDefaults;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -56,7 +59,7 @@ class ExecutableRemoveOperationSupport implements ExecutableRemoveOperation {
|
||||
|
||||
Assert.notNull(domainType, "DomainType must not be null!");
|
||||
|
||||
return new ExecutableRemoveSupport<>(tempate, null, domainType, null);
|
||||
return new ExecutableRemoveSupport<>(tempate, domainType, null, null);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -64,19 +67,20 @@ class ExecutableRemoveOperationSupport implements ExecutableRemoveOperation {
|
||||
* @since 2.0
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@FieldDefaults(level = AccessLevel.PRIVATE, makeFinal = true)
|
||||
static class ExecutableRemoveSupport<T> implements ExecutableRemove<T>, RemoveWithCollection<T> {
|
||||
|
||||
private final MongoTemplate template;
|
||||
private final Query query;
|
||||
private final Class<T> domainType;
|
||||
private final String collection;
|
||||
@NonNull MongoTemplate template;
|
||||
@NonNull Class<T> domainType;
|
||||
Query query;
|
||||
String collection;
|
||||
|
||||
@Override
|
||||
public RemoveWithQuery<T> inCollection(String collection) {
|
||||
|
||||
Assert.hasText(collection, "Collection must not be null nor empty!");
|
||||
|
||||
return new ExecutableRemoveSupport<>(template, query, domainType, collection);
|
||||
return new ExecutableRemoveSupport<>(template, domainType, query, collection);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -84,7 +88,7 @@ class ExecutableRemoveOperationSupport implements ExecutableRemoveOperation {
|
||||
|
||||
Assert.notNull(query, "Query must not be null!");
|
||||
|
||||
return new ExecutableRemoveSupport<>(template, query, domainType, collection);
|
||||
return new ExecutableRemoveSupport<>(template, domainType, query, collection);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -15,7 +15,10 @@
|
||||
*/
|
||||
package org.springframework.data.mongodb.core;
|
||||
|
||||
import lombok.AccessLevel;
|
||||
import lombok.NonNull;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.experimental.FieldDefaults;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
@@ -56,7 +59,7 @@ class ExecutableUpdateOperationSupport implements ExecutableUpdateOperation {
|
||||
|
||||
Assert.notNull(domainType, "DomainType must not be null!");
|
||||
|
||||
return new ExecutableUpdateSupport<>(template, null, domainType, null, null, null);
|
||||
return new ExecutableUpdateSupport<>(template, domainType, null, null, null, null);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -64,22 +67,23 @@ class ExecutableUpdateOperationSupport implements ExecutableUpdateOperation {
|
||||
* @since 2.0
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@FieldDefaults(level = AccessLevel.PRIVATE, makeFinal = true)
|
||||
static class ExecutableUpdateSupport<T>
|
||||
implements ExecutableUpdate<T>, UpdateWithCollection<T>, UpdateWithQuery<T>, TerminatingUpdate<T> {
|
||||
|
||||
private final MongoTemplate template;
|
||||
private final Query query;
|
||||
private final Class<T> domainType;
|
||||
private final Update update;
|
||||
private final String collection;
|
||||
private final FindAndModifyOptions options;
|
||||
@NonNull MongoTemplate template;
|
||||
@NonNull Class<T> domainType;
|
||||
Query query;
|
||||
Update update;
|
||||
String collection;
|
||||
FindAndModifyOptions options;
|
||||
|
||||
@Override
|
||||
public TerminatingUpdate<T> apply(Update update) {
|
||||
|
||||
Assert.notNull(update, "Update must not be null!");
|
||||
|
||||
return new ExecutableUpdateSupport<>(template, query, domainType, update, collection, options);
|
||||
return new ExecutableUpdateSupport<>(template, domainType, query, update, collection, options);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -87,7 +91,7 @@ class ExecutableUpdateOperationSupport implements ExecutableUpdateOperation {
|
||||
|
||||
Assert.hasText(collection, "Collection must not be null nor empty!");
|
||||
|
||||
return new ExecutableUpdateSupport<>(template, query, domainType, update, collection, options);
|
||||
return new ExecutableUpdateSupport<>(template, domainType, query, update, collection, options);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -114,7 +118,7 @@ class ExecutableUpdateOperationSupport implements ExecutableUpdateOperation {
|
||||
|
||||
Assert.notNull(query, "Query must not be null!");
|
||||
|
||||
return new ExecutableUpdateSupport<>(template, query, domainType, update, collection, options);
|
||||
return new ExecutableUpdateSupport<>(template, domainType, query, update, collection, options);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -127,7 +131,7 @@ class ExecutableUpdateOperationSupport implements ExecutableUpdateOperation {
|
||||
|
||||
Assert.notNull(options, "Options must not be null!");
|
||||
|
||||
return new ExecutableUpdateSupport<>(template, query, domainType, update, collection, options);
|
||||
return new ExecutableUpdateSupport<>(template, domainType, query, update, collection, options);
|
||||
}
|
||||
|
||||
private UpdateResult doUpdate(boolean multi, boolean upsert) {
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package org.springframework.data.mongodb.core
|
||||
|
||||
import com.nhaarman.mockito_kotlin.verify
|
||||
import example.first.First
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
@@ -25,6 +26,7 @@ import org.mockito.junit.MockitoJUnitRunner
|
||||
|
||||
/**
|
||||
* @author Sebastien Deleuze
|
||||
* @author Mark Paluch
|
||||
*/
|
||||
@RunWith(MockitoJUnitRunner::class)
|
||||
class ExecutableAggregationOperationExtensionsTests {
|
||||
@@ -34,13 +36,15 @@ class ExecutableAggregationOperationExtensionsTests {
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
fun `aggregateAndReturn(KClass) extension should call its Java counterpart`() {
|
||||
|
||||
operation.aggregateAndReturn(First::class)
|
||||
Mockito.verify(operation, Mockito.times(1)).aggregateAndReturn(First::class.java)
|
||||
verify(operation).aggregateAndReturn(First::class.java)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
fun `aggregateAndReturn() with reified type parameter extension should call its Java counterpart`() {
|
||||
|
||||
operation.aggregateAndReturn<First>()
|
||||
Mockito.verify(operation, Mockito.times(1)).aggregateAndReturn(First::class.java)
|
||||
verify(operation).aggregateAndReturn(First::class.java)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,47 +15,53 @@
|
||||
*/
|
||||
package org.springframework.data.mongodb.core
|
||||
|
||||
import com.nhaarman.mockito_kotlin.verify
|
||||
import example.first.First
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.mockito.Answers
|
||||
import org.mockito.Mock
|
||||
import org.mockito.Mockito
|
||||
import org.mockito.junit.MockitoJUnitRunner
|
||||
|
||||
/**
|
||||
* @author Sebastien Deleuze
|
||||
* @author Mark Paluch
|
||||
*/
|
||||
@RunWith(MockitoJUnitRunner::class)
|
||||
class ExecutableFindOperationExtensionsTests {
|
||||
|
||||
@Mock(answer = Answers.RETURNS_MOCKS)
|
||||
lateinit var operation: ExecutableFindOperation
|
||||
@Mock(answer = Answers.RETURNS_MOCKS)
|
||||
lateinit var operation: ExecutableFindOperation
|
||||
|
||||
@Mock(answer = Answers.RETURNS_MOCKS)
|
||||
lateinit var operationWithProjection: ExecutableFindOperation.FindOperationWithProjection<First>
|
||||
@Mock(answer = Answers.RETURNS_MOCKS)
|
||||
lateinit var operationWithProjection: ExecutableFindOperation.FindWithProjection<First>
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
fun `ExecutableFindOperation#query(KClass) extension should call its Java counterpart`() {
|
||||
operation.query(First::class)
|
||||
Mockito.verify(operation, Mockito.times(1)).query(First::class.java)
|
||||
}
|
||||
@Test // DATAMONGO-1689
|
||||
fun `ExecutableFindOperation#query(KClass) extension should call its Java counterpart`() {
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
fun `ExecutableFindOperation#query() with reified type parameter extension should call its Java counterpart`() {
|
||||
operation.query<First>()
|
||||
Mockito.verify(operation, Mockito.times(1)).query(First::class.java)
|
||||
}
|
||||
operation.query(First::class)
|
||||
verify(operation).query(First::class.java)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
fun `ExecutableFindOperation#FindOperationWithProjection#asType(KClass) extension should call its Java counterpart`() {
|
||||
operationWithProjection.asType(First::class)
|
||||
Mockito.verify(operationWithProjection, Mockito.times(1)).`as`(First::class.java)
|
||||
}
|
||||
@Test // DATAMONGO-1689
|
||||
fun `ExecutableFindOperation#query() with reified type parameter extension should call its Java counterpart`() {
|
||||
|
||||
operation.query<First>()
|
||||
verify(operation).query(First::class.java)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
fun `ExecutableFindOperation#FindOperationWithProjection#asType(KClass) extension should call its Java counterpart`() {
|
||||
|
||||
operationWithProjection.asType(First::class)
|
||||
verify(operationWithProjection).`as`(First::class.java)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
fun `ExecutableFindOperation#FindOperationWithProjection#asType() with reified type parameter extension should call its Java counterpart`() {
|
||||
|
||||
operationWithProjection.asType()
|
||||
verify(operationWithProjection).`as`(First::class.java)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
fun `ExecutableFindOperation#FindOperationWithProjection#asType() with reified type parameter extension should call its Java counterpart`() {
|
||||
operationWithProjection.asType()
|
||||
Mockito.verify(operationWithProjection, Mockito.times(1)).`as`(First::class.java)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,32 +15,36 @@
|
||||
*/
|
||||
package org.springframework.data.mongodb.core
|
||||
|
||||
import com.nhaarman.mockito_kotlin.verify
|
||||
import example.first.First
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.mockito.Answers
|
||||
import org.mockito.Mock
|
||||
import org.mockito.Mockito
|
||||
import org.mockito.junit.MockitoJUnitRunner
|
||||
|
||||
/**
|
||||
* @author Sebastien Deleuze
|
||||
* @author Mark Paluch
|
||||
*/
|
||||
@RunWith(MockitoJUnitRunner::class)
|
||||
class ExecutableInsertOperationExtensionsTests {
|
||||
|
||||
@Mock(answer = Answers.RETURNS_MOCKS)
|
||||
lateinit var operation: ExecutableInsertOperation
|
||||
@Mock(answer = Answers.RETURNS_MOCKS)
|
||||
lateinit var operation: ExecutableInsertOperation
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
fun `insert(KClass) extension should call its Java counterpart`() {
|
||||
operation.insert(First::class)
|
||||
Mockito.verify(operation, Mockito.times(1)).insert(First::class.java)
|
||||
}
|
||||
@Test // DATAMONGO-1689
|
||||
fun `insert(KClass) extension should call its Java counterpart`() {
|
||||
|
||||
operation.insert(First::class)
|
||||
verify(operation).insert(First::class.java)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
fun `insert() with reified type parameter extension should call its Java counterpart`() {
|
||||
|
||||
operation.insert<First>()
|
||||
verify(operation).insert(First::class.java)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
fun `insert() with reified type parameter extension should call its Java counterpart`() {
|
||||
operation.insert<First>()
|
||||
Mockito.verify(operation, Mockito.times(1)).insert(First::class.java)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,32 +15,36 @@
|
||||
*/
|
||||
package org.springframework.data.mongodb.core
|
||||
|
||||
import com.nhaarman.mockito_kotlin.verify
|
||||
import example.first.First
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.mockito.Answers
|
||||
import org.mockito.Mock
|
||||
import org.mockito.Mockito
|
||||
import org.mockito.junit.MockitoJUnitRunner
|
||||
|
||||
/**
|
||||
* @author Sebastien Deleuze
|
||||
* @author Mark Paluch
|
||||
*/
|
||||
@RunWith(MockitoJUnitRunner::class)
|
||||
class ExecutableRemoveOperationExtensionsTests {
|
||||
|
||||
@Mock(answer = Answers.RETURNS_MOCKS)
|
||||
lateinit var operation: ExecutableRemoveOperation
|
||||
@Mock(answer = Answers.RETURNS_MOCKS)
|
||||
lateinit var operation: ExecutableRemoveOperation
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
fun `remove(KClass) extension should call its Java counterpart`() {
|
||||
operation.remove(First::class)
|
||||
Mockito.verify(operation, Mockito.times(1)).remove(First::class.java)
|
||||
}
|
||||
@Test // DATAMONGO-1689
|
||||
fun `remove(KClass) extension should call its Java counterpart`() {
|
||||
|
||||
operation.remove(First::class)
|
||||
verify(operation).remove(First::class.java)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
fun `remove() with reified type parameter extension should call its Java counterpart`() {
|
||||
|
||||
operation.remove<First>()
|
||||
verify(operation).remove(First::class.java)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
fun `remove() with reified type parameter extension should call its Java counterpart`() {
|
||||
operation.remove<First>()
|
||||
Mockito.verify(operation, Mockito.times(1)).remove(First::class.java)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,6 +35,7 @@ import org.springframework.data.mongodb.core.query.Update
|
||||
|
||||
/**
|
||||
* @author Sebastien Deleuze
|
||||
* @author Mark Paluch
|
||||
*/
|
||||
@RunWith(MockitoJUnitRunner::class)
|
||||
class MongoOperationsExtensionsTests {
|
||||
@@ -46,14 +47,14 @@ class MongoOperationsExtensionsTests {
|
||||
fun `getCollectionName(KClass) extension should call its Java counterpart`() {
|
||||
|
||||
operations.getCollectionName(First::class)
|
||||
verify(operations, times(1)).getCollectionName(First::class.java)
|
||||
verify(operations).getCollectionName(First::class.java)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
fun `getCollectionName() with reified type parameter extension should call its Java counterpart`() {
|
||||
|
||||
operations.getCollectionName<First>()
|
||||
verify(operations, times(1)).getCollectionName(First::class.java)
|
||||
verify(operations).getCollectionName(First::class.java)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
@@ -61,7 +62,7 @@ class MongoOperationsExtensionsTests {
|
||||
|
||||
val collectionCallback = mock<CollectionCallback<First>>()
|
||||
operations.execute(collectionCallback)
|
||||
verify(operations, times(1)).execute(First::class.java, collectionCallback)
|
||||
verify(operations).execute(First::class.java, collectionCallback)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
@@ -69,7 +70,7 @@ class MongoOperationsExtensionsTests {
|
||||
|
||||
val query = mock<Query>()
|
||||
operations.stream<First>(query)
|
||||
verify(operations, times(1)).stream(query, First::class.java)
|
||||
verify(operations).stream(query, First::class.java)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
@@ -78,14 +79,14 @@ class MongoOperationsExtensionsTests {
|
||||
val query = mock<Query>()
|
||||
val collectionName = "foo"
|
||||
operations.stream<First>(query, collectionName)
|
||||
verify(operations, times(1)).stream(query, First::class.java, collectionName)
|
||||
verify(operations).stream(query, First::class.java, collectionName)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
fun `createCollection(KClass) extension should call its Java counterpart`() {
|
||||
|
||||
operations.createCollection(First::class)
|
||||
verify(operations, times(1)).createCollection(First::class.java)
|
||||
verify(operations).createCollection(First::class.java)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
@@ -93,14 +94,14 @@ class MongoOperationsExtensionsTests {
|
||||
|
||||
val collectionOptions = mock<CollectionOptions>()
|
||||
operations.createCollection(First::class, collectionOptions)
|
||||
verify(operations, times(1)).createCollection(First::class.java, collectionOptions)
|
||||
verify(operations).createCollection(First::class.java, collectionOptions)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
fun `createCollection() with reified type parameter extension should call its Java counterpart`() {
|
||||
|
||||
operations.createCollection<First>()
|
||||
verify(operations, times(1)).createCollection(First::class.java)
|
||||
verify(operations).createCollection(First::class.java)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
@@ -108,7 +109,7 @@ class MongoOperationsExtensionsTests {
|
||||
|
||||
val collectionOptions = mock<CollectionOptions>()
|
||||
operations.createCollection<First>(collectionOptions)
|
||||
verify(operations, times(1)).createCollection(First::class.java, collectionOptions)
|
||||
verify(operations).createCollection(First::class.java, collectionOptions)
|
||||
}
|
||||
|
||||
|
||||
@@ -116,42 +117,42 @@ class MongoOperationsExtensionsTests {
|
||||
fun `collectionExists(KClass) extension should call its Java counterpart`() {
|
||||
|
||||
operations.collectionExists(First::class)
|
||||
verify(operations, times(1)).collectionExists(First::class.java)
|
||||
verify(operations).collectionExists(First::class.java)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
fun `collectionExists() with reified type parameter extension should call its Java counterpart`() {
|
||||
|
||||
operations.collectionExists<First>()
|
||||
verify(operations, times(1)).collectionExists(First::class.java)
|
||||
verify(operations).collectionExists(First::class.java)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
fun `dropCollection(KClass) extension should call its Java counterpart`() {
|
||||
|
||||
operations.dropCollection(First::class)
|
||||
verify(operations, times(1)).dropCollection(First::class.java)
|
||||
verify(operations).dropCollection(First::class.java)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
fun `dropCollection() with reified type parameter extension should call its Java counterpart`() {
|
||||
|
||||
operations.dropCollection<First>()
|
||||
verify(operations, times(1)).dropCollection(First::class.java)
|
||||
verify(operations).dropCollection(First::class.java)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
fun `indexOps(KClass) extension should call its Java counterpart`() {
|
||||
|
||||
operations.indexOps(First::class)
|
||||
verify(operations, times(1)).indexOps(First::class.java)
|
||||
verify(operations).indexOps(First::class.java)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
fun `indexOps() with reified type parameter extension should call its Java counterpart`() {
|
||||
|
||||
operations.indexOps<First>()
|
||||
verify(operations, times(1)).indexOps(First::class.java)
|
||||
verify(operations).indexOps(First::class.java)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
@@ -160,7 +161,7 @@ class MongoOperationsExtensionsTests {
|
||||
val bulkMode = BulkMode.ORDERED
|
||||
|
||||
operations.bulkOps(bulkMode, First::class)
|
||||
verify(operations, times(1)).bulkOps(bulkMode, First::class.java)
|
||||
verify(operations).bulkOps(bulkMode, First::class.java)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
@@ -170,7 +171,7 @@ class MongoOperationsExtensionsTests {
|
||||
val collectionName = "foo"
|
||||
|
||||
operations.bulkOps(bulkMode, First::class, collectionName)
|
||||
verify(operations, times(1)).bulkOps(bulkMode, First::class.java, collectionName)
|
||||
verify(operations).bulkOps(bulkMode, First::class.java, collectionName)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
@@ -179,7 +180,7 @@ class MongoOperationsExtensionsTests {
|
||||
val bulkMode = BulkMode.ORDERED
|
||||
|
||||
operations.bulkOps<First>(bulkMode)
|
||||
verify(operations, times(1)).bulkOps(bulkMode, First::class.java)
|
||||
verify(operations).bulkOps(bulkMode, First::class.java)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
@@ -189,14 +190,14 @@ class MongoOperationsExtensionsTests {
|
||||
val collectionName = "foo"
|
||||
|
||||
operations.bulkOps<First>(bulkMode, collectionName)
|
||||
verify(operations, times(1)).bulkOps(bulkMode, First::class.java, collectionName)
|
||||
verify(operations).bulkOps(bulkMode, First::class.java, collectionName)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
fun `findAll() with reified type parameter extension should call its Java counterpart`() {
|
||||
|
||||
operations.findAll<First>()
|
||||
verify(operations, times(1)).findAll(First::class.java)
|
||||
verify(operations).findAll(First::class.java)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
@@ -205,7 +206,7 @@ class MongoOperationsExtensionsTests {
|
||||
val collectionName = "foo"
|
||||
|
||||
operations.findAll<First>(collectionName)
|
||||
verify(operations, times(1)).findAll(First::class.java, collectionName)
|
||||
verify(operations).findAll(First::class.java, collectionName)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
@@ -215,7 +216,7 @@ class MongoOperationsExtensionsTests {
|
||||
val groupBy = mock<GroupBy>()
|
||||
|
||||
operations.group<First>(collectionName, groupBy)
|
||||
verify(operations, times(1)).group(collectionName, groupBy, First::class.java)
|
||||
verify(operations).group(collectionName, groupBy, First::class.java)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
@@ -226,7 +227,7 @@ class MongoOperationsExtensionsTests {
|
||||
val groupBy = mock<GroupBy>()
|
||||
|
||||
operations.group<First>(criteria, collectionName, groupBy)
|
||||
verify(operations, times(1)).group(criteria, collectionName, groupBy, First::class.java)
|
||||
verify(operations).group(criteria, collectionName, groupBy, First::class.java)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
@@ -235,7 +236,7 @@ class MongoOperationsExtensionsTests {
|
||||
val aggregation = mock<Aggregation>()
|
||||
|
||||
operations.aggregate<First>(aggregation, Second::class)
|
||||
verify(operations, times(1)).aggregate(aggregation, Second::class.java, First::class.java)
|
||||
verify(operations).aggregate(aggregation, Second::class.java, First::class.java)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
@@ -245,7 +246,7 @@ class MongoOperationsExtensionsTests {
|
||||
val collectionName = "foo"
|
||||
|
||||
operations.aggregate<First>(aggregation, collectionName)
|
||||
verify(operations, times(1)).aggregate(aggregation, collectionName, First::class.java)
|
||||
verify(operations).aggregate(aggregation, collectionName, First::class.java)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
@@ -254,7 +255,7 @@ class MongoOperationsExtensionsTests {
|
||||
val aggregation = mock<Aggregation>()
|
||||
|
||||
operations.aggregateStream<First>(aggregation, Second::class)
|
||||
verify(operations, times(1)).aggregateStream(aggregation, Second::class.java, First::class.java)
|
||||
verify(operations).aggregateStream(aggregation, Second::class.java, First::class.java)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
@@ -264,7 +265,7 @@ class MongoOperationsExtensionsTests {
|
||||
val collectionName = "foo"
|
||||
|
||||
operations.aggregateStream<First>(aggregation, collectionName)
|
||||
verify(operations, times(1)).aggregateStream(aggregation, collectionName, First::class.java)
|
||||
verify(operations).aggregateStream(aggregation, collectionName, First::class.java)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
@@ -275,7 +276,7 @@ class MongoOperationsExtensionsTests {
|
||||
val reduceFunction = "baz"
|
||||
|
||||
operations.mapReduce<First>(collectionName, mapFunction, reduceFunction)
|
||||
verify(operations, times(1)).mapReduce(collectionName, mapFunction, reduceFunction, First::class.java)
|
||||
verify(operations).mapReduce(collectionName, mapFunction, reduceFunction, First::class.java)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
@@ -287,7 +288,7 @@ class MongoOperationsExtensionsTests {
|
||||
val options = mock<MapReduceOptions>()
|
||||
|
||||
operations.mapReduce<First>(collectionName, mapFunction, reduceFunction, options)
|
||||
verify(operations, times(1)).mapReduce(collectionName, mapFunction, reduceFunction, options, First::class.java)
|
||||
verify(operations).mapReduce(collectionName, mapFunction, reduceFunction, options, First::class.java)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
@@ -299,7 +300,7 @@ class MongoOperationsExtensionsTests {
|
||||
val reduceFunction = "baz"
|
||||
|
||||
operations.mapReduce<First>(query, collectionName, mapFunction, reduceFunction)
|
||||
verify(operations, times(1)).mapReduce(query, collectionName, mapFunction, reduceFunction, First::class.java)
|
||||
verify(operations).mapReduce(query, collectionName, mapFunction, reduceFunction, First::class.java)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
@@ -312,7 +313,7 @@ class MongoOperationsExtensionsTests {
|
||||
val options = mock<MapReduceOptions>()
|
||||
|
||||
operations.mapReduce<First>(query, collectionName, mapFunction, reduceFunction, options)
|
||||
verify(operations, times(1)).mapReduce(query, collectionName, mapFunction, reduceFunction, options, First::class.java)
|
||||
verify(operations).mapReduce(query, collectionName, mapFunction, reduceFunction, options, First::class.java)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
@@ -321,7 +322,7 @@ class MongoOperationsExtensionsTests {
|
||||
val query = NearQuery.near(0.0, 0.0)
|
||||
|
||||
operations.geoNear<First>(query)
|
||||
verify(operations, times(1)).geoNear(query, First::class.java)
|
||||
verify(operations).geoNear(query, First::class.java)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
@@ -331,7 +332,7 @@ class MongoOperationsExtensionsTests {
|
||||
val query = NearQuery.near(0.0, 0.0)
|
||||
|
||||
operations.geoNear<First>(query, collectionName)
|
||||
verify(operations, times(1)).geoNear(query, First::class.java, collectionName)
|
||||
verify(operations).geoNear(query, First::class.java, collectionName)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
@@ -340,7 +341,7 @@ class MongoOperationsExtensionsTests {
|
||||
val query = mock<Query>()
|
||||
|
||||
operations.findOne<First>(query)
|
||||
verify(operations, times(1)).findOne(query, First::class.java)
|
||||
verify(operations).findOne(query, First::class.java)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
@@ -350,7 +351,7 @@ class MongoOperationsExtensionsTests {
|
||||
val query = mock<Query>()
|
||||
|
||||
operations.findOne<First>(query, collectionName)
|
||||
verify(operations, times(1)).findOne(query, First::class.java, collectionName)
|
||||
verify(operations).findOne(query, First::class.java, collectionName)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
@@ -359,7 +360,7 @@ class MongoOperationsExtensionsTests {
|
||||
val query = mock<Query>()
|
||||
|
||||
operations.exists(query, First::class)
|
||||
verify(operations, times(1)).exists(query, First::class.java)
|
||||
verify(operations).exists(query, First::class.java)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
@@ -368,7 +369,7 @@ class MongoOperationsExtensionsTests {
|
||||
val query = mock<Query>()
|
||||
|
||||
operations.exists<First>(query)
|
||||
verify(operations, times(1)).exists(query, First::class.java)
|
||||
verify(operations).exists(query, First::class.java)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
@@ -377,7 +378,7 @@ class MongoOperationsExtensionsTests {
|
||||
val query = mock<Query>()
|
||||
|
||||
operations.find<First>(query)
|
||||
verify(operations, times(1)).find(query, First::class.java)
|
||||
verify(operations).find(query, First::class.java)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
@@ -387,7 +388,7 @@ class MongoOperationsExtensionsTests {
|
||||
val query = mock<Query>()
|
||||
|
||||
operations.find<First>(query, collectionName)
|
||||
verify(operations, times(1)).find(query, First::class.java, collectionName)
|
||||
verify(operations).find(query, First::class.java, collectionName)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
@@ -396,7 +397,7 @@ class MongoOperationsExtensionsTests {
|
||||
val id = 1L
|
||||
|
||||
operations.findById<First>(id)
|
||||
verify(operations, times(1)).findById(id, First::class.java)
|
||||
verify(operations).findById(id, First::class.java)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
@@ -406,7 +407,7 @@ class MongoOperationsExtensionsTests {
|
||||
val id = 1L
|
||||
|
||||
operations.findById<First>(id, collectionName)
|
||||
verify(operations, times(1)).findById(id, First::class.java, collectionName)
|
||||
verify(operations).findById(id, First::class.java, collectionName)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
@@ -417,7 +418,7 @@ class MongoOperationsExtensionsTests {
|
||||
val options = mock<FindAndModifyOptions>()
|
||||
|
||||
operations.findAndModify<First>(query, update, options)
|
||||
verify(operations, times(1)).findAndModify(query, update, options, First::class.java)
|
||||
verify(operations).findAndModify(query, update, options, First::class.java)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
@@ -429,7 +430,7 @@ class MongoOperationsExtensionsTests {
|
||||
val options = mock<FindAndModifyOptions>()
|
||||
|
||||
operations.findAndModify<First>(query, update, options, collectionName)
|
||||
verify(operations, times(1)).findAndModify(query, update, options, First::class.java, collectionName)
|
||||
verify(operations).findAndModify(query, update, options, First::class.java, collectionName)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
@@ -438,7 +439,7 @@ class MongoOperationsExtensionsTests {
|
||||
val query = mock<Query>()
|
||||
|
||||
operations.findAndRemove<First>(query)
|
||||
verify(operations, times(1)).findAndRemove(query, First::class.java)
|
||||
verify(operations).findAndRemove(query, First::class.java)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
@@ -448,14 +449,14 @@ class MongoOperationsExtensionsTests {
|
||||
val collectionName = "foo"
|
||||
|
||||
operations.findAndRemove<First>(query, collectionName)
|
||||
verify(operations, times(1)).findAndRemove(query, First::class.java, collectionName)
|
||||
verify(operations).findAndRemove(query, First::class.java, collectionName)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
fun `count() with reified type parameter extension should call its Java counterpart`() {
|
||||
|
||||
operations.count<First>()
|
||||
verify(operations, times(1)).count(any<Query>(), eq(First::class.java))
|
||||
verify(operations).count(any<Query>(), eq(First::class.java))
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
@@ -464,7 +465,7 @@ class MongoOperationsExtensionsTests {
|
||||
val query = mock<Query>()
|
||||
|
||||
operations.count<First>(query)
|
||||
verify(operations, times(1)).count(query, First::class.java)
|
||||
verify(operations).count(query, First::class.java)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
@@ -474,7 +475,7 @@ class MongoOperationsExtensionsTests {
|
||||
val collectionName = "foo"
|
||||
|
||||
operations.count<First>(query, collectionName)
|
||||
verify(operations, times(1)).count(query, First::class.java, collectionName)
|
||||
verify(operations).count(query, First::class.java, collectionName)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
@@ -483,7 +484,7 @@ class MongoOperationsExtensionsTests {
|
||||
val query = mock<Query>()
|
||||
|
||||
operations.count(query, First::class)
|
||||
verify(operations, times(1)).count(query, First::class.java)
|
||||
verify(operations).count(query, First::class.java)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
@@ -493,7 +494,7 @@ class MongoOperationsExtensionsTests {
|
||||
val collectionName = "foo"
|
||||
|
||||
operations.count(query, First::class, collectionName)
|
||||
verify(operations, times(1)).count(query, First::class.java, collectionName)
|
||||
verify(operations).count(query, First::class.java, collectionName)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
@@ -502,7 +503,7 @@ class MongoOperationsExtensionsTests {
|
||||
val collection = listOf(First(), First())
|
||||
|
||||
operations.insert(collection, First::class)
|
||||
verify(operations, times(1)).insert(collection, First::class.java)
|
||||
verify(operations).insert(collection, First::class.java)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
@@ -512,7 +513,7 @@ class MongoOperationsExtensionsTests {
|
||||
val update = mock<Update>()
|
||||
|
||||
operations.upsert(query, update, First::class)
|
||||
verify(operations, times(1)).upsert(query, update, First::class.java)
|
||||
verify(operations).upsert(query, update, First::class.java)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
@@ -523,7 +524,7 @@ class MongoOperationsExtensionsTests {
|
||||
val collectionName = "foo"
|
||||
|
||||
operations.upsert(query, update, First::class, collectionName)
|
||||
verify(operations, times(1)).upsert(query, update, First::class.java, collectionName)
|
||||
verify(operations).upsert(query, update, First::class.java, collectionName)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
@@ -533,7 +534,7 @@ class MongoOperationsExtensionsTests {
|
||||
val update = mock<Update>()
|
||||
|
||||
operations.upsert<First>(query, update)
|
||||
verify(operations, times(1)).upsert(query, update, First::class.java)
|
||||
verify(operations).upsert(query, update, First::class.java)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
@@ -544,7 +545,7 @@ class MongoOperationsExtensionsTests {
|
||||
val collectionName = "foo"
|
||||
|
||||
operations.upsert<First>(query, update, collectionName)
|
||||
verify(operations, times(1)).upsert(query, update, First::class.java, collectionName)
|
||||
verify(operations).upsert(query, update, First::class.java, collectionName)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
@@ -554,7 +555,7 @@ class MongoOperationsExtensionsTests {
|
||||
val update = mock<Update>()
|
||||
|
||||
operations.updateFirst(query, update, First::class)
|
||||
verify(operations, times(1)).updateFirst(query, update, First::class.java)
|
||||
verify(operations).updateFirst(query, update, First::class.java)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
@@ -565,7 +566,7 @@ class MongoOperationsExtensionsTests {
|
||||
val collectionName = "foo"
|
||||
|
||||
operations.updateFirst(query, update, First::class, collectionName)
|
||||
verify(operations, times(1)).updateFirst(query, update, First::class.java, collectionName)
|
||||
verify(operations).updateFirst(query, update, First::class.java, collectionName)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
@@ -575,7 +576,7 @@ class MongoOperationsExtensionsTests {
|
||||
val update = mock<Update>()
|
||||
|
||||
operations.updateFirst<First>(query, update)
|
||||
verify(operations, times(1)).updateFirst(query, update, First::class.java)
|
||||
verify(operations).updateFirst(query, update, First::class.java)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
@@ -586,7 +587,7 @@ class MongoOperationsExtensionsTests {
|
||||
val collectionName = "foo"
|
||||
|
||||
operations.updateFirst<First>(query, update, collectionName)
|
||||
verify(operations, times(1)).updateFirst(query, update, First::class.java, collectionName)
|
||||
verify(operations).updateFirst(query, update, First::class.java, collectionName)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
@@ -596,7 +597,7 @@ class MongoOperationsExtensionsTests {
|
||||
val update = mock<Update>()
|
||||
|
||||
operations.updateMulti(query, update, First::class)
|
||||
verify(operations, times(1)).updateMulti(query, update, First::class.java)
|
||||
verify(operations).updateMulti(query, update, First::class.java)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
@@ -607,7 +608,7 @@ class MongoOperationsExtensionsTests {
|
||||
val collectionName = "foo"
|
||||
|
||||
operations.updateMulti(query, update, First::class, collectionName)
|
||||
verify(operations, times(1)).updateMulti(query, update, First::class.java, collectionName)
|
||||
verify(operations).updateMulti(query, update, First::class.java, collectionName)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
@@ -617,7 +618,7 @@ class MongoOperationsExtensionsTests {
|
||||
val update = mock<Update>()
|
||||
|
||||
operations.updateMulti<First>(query, update)
|
||||
verify(operations, times(1)).updateMulti(query, update, First::class.java)
|
||||
verify(operations).updateMulti(query, update, First::class.java)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
@@ -628,7 +629,7 @@ class MongoOperationsExtensionsTests {
|
||||
val collectionName = "foo"
|
||||
|
||||
operations.updateMulti<First>(query, update, collectionName)
|
||||
verify(operations, times(1)).updateMulti(query, update, First::class.java, collectionName)
|
||||
verify(operations).updateMulti(query, update, First::class.java, collectionName)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
@@ -637,7 +638,7 @@ class MongoOperationsExtensionsTests {
|
||||
val query = mock<Query>()
|
||||
|
||||
operations.remove(query, First::class)
|
||||
verify(operations, times(1)).remove(query, First::class.java)
|
||||
verify(operations).remove(query, First::class.java)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
@@ -647,7 +648,7 @@ class MongoOperationsExtensionsTests {
|
||||
val collectionName = "foo"
|
||||
|
||||
operations.remove(query, First::class, collectionName)
|
||||
verify(operations, times(1)).remove(query, First::class.java, collectionName)
|
||||
verify(operations).remove(query, First::class.java, collectionName)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
@@ -656,7 +657,7 @@ class MongoOperationsExtensionsTests {
|
||||
val query = mock<Query>()
|
||||
|
||||
operations.remove<First>(query)
|
||||
verify(operations, times(1)).remove(query, First::class.java)
|
||||
verify(operations).remove(query, First::class.java)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
@@ -666,7 +667,7 @@ class MongoOperationsExtensionsTests {
|
||||
val collectionName = "foo"
|
||||
|
||||
operations.remove<First>(query, collectionName)
|
||||
verify(operations, times(1)).remove(query, First::class.java, collectionName)
|
||||
verify(operations).remove(query, First::class.java, collectionName)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
@@ -675,6 +676,6 @@ class MongoOperationsExtensionsTests {
|
||||
val query = mock<Query>()
|
||||
|
||||
operations.findAllAndRemove<First>(query)
|
||||
verify(operations, times(1)).findAllAndRemove(query, First::class.java)
|
||||
verify(operations).findAllAndRemove(query, First::class.java)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,14 +41,14 @@ class ReactiveMongoOperationsExtensionsTests {
|
||||
fun `indexOps(KClass) extension should call its Java counterpart`() {
|
||||
|
||||
operations.indexOps(First::class)
|
||||
verify(operations, times(1)).indexOps(First::class.java)
|
||||
verify(operations).indexOps(First::class.java)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
fun `indexOps() with reified type parameter extension should call its Java counterpart`() {
|
||||
|
||||
operations.indexOps<First>()
|
||||
verify(operations, times(1)).indexOps(First::class.java)
|
||||
verify(operations).indexOps(First::class.java)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
@@ -57,14 +57,14 @@ class ReactiveMongoOperationsExtensionsTests {
|
||||
val collectionCallback = mock<ReactiveCollectionCallback<First>>()
|
||||
|
||||
operations.execute(collectionCallback)
|
||||
verify(operations, times(1)).execute(First::class.java, collectionCallback)
|
||||
verify(operations).execute(First::class.java, collectionCallback)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
fun `createCollection(KClass) extension should call its Java counterpart`() {
|
||||
|
||||
operations.createCollection(First::class)
|
||||
verify(operations, times(1)).createCollection(First::class.java)
|
||||
verify(operations).createCollection(First::class.java)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
@@ -73,14 +73,14 @@ class ReactiveMongoOperationsExtensionsTests {
|
||||
val collectionOptions = mock<CollectionOptions>()
|
||||
|
||||
operations.createCollection(First::class, collectionOptions)
|
||||
verify(operations, times(1)).createCollection(First::class.java, collectionOptions)
|
||||
verify(operations).createCollection(First::class.java, collectionOptions)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
fun `createCollection() with reified type parameter extension should call its Java counterpart`() {
|
||||
|
||||
operations.createCollection<First>()
|
||||
verify(operations, times(1)).createCollection(First::class.java)
|
||||
verify(operations).createCollection(First::class.java)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
@@ -89,42 +89,42 @@ class ReactiveMongoOperationsExtensionsTests {
|
||||
val collectionOptions = mock<CollectionOptions>()
|
||||
|
||||
operations.createCollection<First>(collectionOptions)
|
||||
verify(operations, times(1)).createCollection(First::class.java, collectionOptions)
|
||||
verify(operations).createCollection(First::class.java, collectionOptions)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
fun `collectionExists(KClass) extension should call its Java counterpart`() {
|
||||
|
||||
operations.collectionExists(First::class)
|
||||
verify(operations, times(1)).collectionExists(First::class.java)
|
||||
verify(operations).collectionExists(First::class.java)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
fun `collectionExists() with reified type parameter extension should call its Java counterpart`() {
|
||||
|
||||
operations.collectionExists<First>()
|
||||
verify(operations, times(1)).collectionExists(First::class.java)
|
||||
verify(operations).collectionExists(First::class.java)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
fun `dropCollection(KClass) extension should call its Java counterpart`() {
|
||||
|
||||
operations.dropCollection(First::class)
|
||||
verify(operations, times(1)).dropCollection(First::class.java)
|
||||
verify(operations).dropCollection(First::class.java)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
fun `dropCollection() with reified type parameter extension should call its Java counterpart`() {
|
||||
|
||||
operations.dropCollection<First>()
|
||||
verify(operations, times(1)).dropCollection(First::class.java)
|
||||
verify(operations).dropCollection(First::class.java)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
fun `findAll() with reified type parameter extension should call its Java counterpart`() {
|
||||
|
||||
operations.findAll<First>()
|
||||
verify(operations, times(1)).findAll(First::class.java)
|
||||
verify(operations).findAll(First::class.java)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
@@ -133,7 +133,7 @@ class ReactiveMongoOperationsExtensionsTests {
|
||||
val collectionName = "foo"
|
||||
|
||||
operations.findAll<First>(collectionName)
|
||||
verify(operations, times(1)).findAll(First::class.java, collectionName)
|
||||
verify(operations).findAll(First::class.java, collectionName)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
@@ -142,7 +142,7 @@ class ReactiveMongoOperationsExtensionsTests {
|
||||
val query = mock<Query>()
|
||||
|
||||
operations.findOne<First>(query)
|
||||
verify(operations, times(1)).findOne(query, First::class.java)
|
||||
verify(operations).findOne(query, First::class.java)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
@@ -152,7 +152,7 @@ class ReactiveMongoOperationsExtensionsTests {
|
||||
val query = mock<Query>()
|
||||
|
||||
operations.findOne<First>(query, collectionName)
|
||||
verify(operations, times(1)).findOne(query, First::class.java, collectionName)
|
||||
verify(operations).findOne(query, First::class.java, collectionName)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
@@ -161,7 +161,7 @@ class ReactiveMongoOperationsExtensionsTests {
|
||||
val query = mock<Query>()
|
||||
|
||||
operations.exists(query, First::class)
|
||||
verify(operations, times(1)).exists(query, First::class.java)
|
||||
verify(operations).exists(query, First::class.java)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
@@ -170,7 +170,7 @@ class ReactiveMongoOperationsExtensionsTests {
|
||||
val query = mock<Query>()
|
||||
|
||||
operations.exists<First>(query)
|
||||
verify(operations, times(1)).exists(query, First::class.java)
|
||||
verify(operations).exists(query, First::class.java)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
@@ -179,7 +179,7 @@ class ReactiveMongoOperationsExtensionsTests {
|
||||
val query = mock<Query>()
|
||||
|
||||
operations.find<First>(query)
|
||||
verify(operations, times(1)).find(query, First::class.java)
|
||||
verify(operations).find(query, First::class.java)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
@@ -189,7 +189,7 @@ class ReactiveMongoOperationsExtensionsTests {
|
||||
val query = mock<Query>()
|
||||
|
||||
operations.find<First>(query, collectionName)
|
||||
verify(operations, times(1)).find(query, First::class.java, collectionName)
|
||||
verify(operations).find(query, First::class.java, collectionName)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
@@ -198,7 +198,7 @@ class ReactiveMongoOperationsExtensionsTests {
|
||||
val id = 1L
|
||||
|
||||
operations.findById<First>(id)
|
||||
verify(operations, times(1)).findById(id, First::class.java)
|
||||
verify(operations).findById(id, First::class.java)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
@@ -208,7 +208,7 @@ class ReactiveMongoOperationsExtensionsTests {
|
||||
val id = 1L
|
||||
|
||||
operations.findById<First>(id, collectionName)
|
||||
verify(operations, times(1)).findById(id, First::class.java, collectionName)
|
||||
verify(operations).findById(id, First::class.java, collectionName)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
@@ -217,7 +217,7 @@ class ReactiveMongoOperationsExtensionsTests {
|
||||
val query = NearQuery.near(0.0, 0.0)
|
||||
|
||||
operations.geoNear<First>(query)
|
||||
verify(operations, times(1)).geoNear(query, First::class.java)
|
||||
verify(operations).geoNear(query, First::class.java)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
@@ -227,7 +227,7 @@ class ReactiveMongoOperationsExtensionsTests {
|
||||
val query = NearQuery.near(0.0, 0.0)
|
||||
|
||||
operations.geoNear<First>(query, collectionName)
|
||||
verify(operations, times(1)).geoNear(query, First::class.java, collectionName)
|
||||
verify(operations).geoNear(query, First::class.java, collectionName)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
@@ -238,7 +238,7 @@ class ReactiveMongoOperationsExtensionsTests {
|
||||
val options = mock<FindAndModifyOptions>()
|
||||
|
||||
operations.findAndModify<First>(query, update, options)
|
||||
verify(operations, times(1)).findAndModify(query, update, options, First::class.java)
|
||||
verify(operations).findAndModify(query, update, options, First::class.java)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
@@ -250,7 +250,7 @@ class ReactiveMongoOperationsExtensionsTests {
|
||||
val options = mock<FindAndModifyOptions>()
|
||||
|
||||
operations.findAndModify<First>(query, update, options, collectionName)
|
||||
verify(operations, times(1)).findAndModify(query, update, options, First::class.java, collectionName)
|
||||
verify(operations).findAndModify(query, update, options, First::class.java, collectionName)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
@@ -259,7 +259,7 @@ class ReactiveMongoOperationsExtensionsTests {
|
||||
val query = mock<Query>()
|
||||
|
||||
operations.findAndRemove<First>(query)
|
||||
verify(operations, times(1)).findAndRemove(query, First::class.java)
|
||||
verify(operations).findAndRemove(query, First::class.java)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
@@ -269,14 +269,14 @@ class ReactiveMongoOperationsExtensionsTests {
|
||||
val collectionName = "foo"
|
||||
|
||||
operations.findAndRemove<First>(query, collectionName)
|
||||
verify(operations, times(1)).findAndRemove(query, First::class.java, collectionName)
|
||||
verify(operations).findAndRemove(query, First::class.java, collectionName)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
fun `count() with reified type parameter extension should call its Java counterpart`() {
|
||||
|
||||
operations.count<First>()
|
||||
verify(operations, times(1)).count(any<Query>(), eq(First::class.java))
|
||||
verify(operations).count(any<Query>(), eq(First::class.java))
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
@@ -285,7 +285,7 @@ class ReactiveMongoOperationsExtensionsTests {
|
||||
val query = mock<Query>()
|
||||
|
||||
operations.count<First>(query)
|
||||
verify(operations, times(1)).count(query, First::class.java)
|
||||
verify(operations).count(query, First::class.java)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
@@ -295,7 +295,7 @@ class ReactiveMongoOperationsExtensionsTests {
|
||||
val collectionName = "foo"
|
||||
|
||||
operations.count<First>(query, collectionName)
|
||||
verify(operations, times(1)).count(query, First::class.java, collectionName)
|
||||
verify(operations).count(query, First::class.java, collectionName)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
@@ -304,7 +304,7 @@ class ReactiveMongoOperationsExtensionsTests {
|
||||
val query = mock<Query>()
|
||||
|
||||
operations.count(query, First::class)
|
||||
verify(operations, times(1)).count(query, First::class.java)
|
||||
verify(operations).count(query, First::class.java)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
@@ -314,7 +314,7 @@ class ReactiveMongoOperationsExtensionsTests {
|
||||
val collectionName = "foo"
|
||||
|
||||
operations.count(query, First::class, collectionName)
|
||||
verify(operations, times(1)).count(query, First::class.java, collectionName)
|
||||
verify(operations).count(query, First::class.java, collectionName)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
@@ -323,7 +323,7 @@ class ReactiveMongoOperationsExtensionsTests {
|
||||
val collection = listOf(First(), First())
|
||||
|
||||
operations.insert(collection, First::class)
|
||||
verify(operations, times(1)).insert(collection, First::class.java)
|
||||
verify(operations).insert(collection, First::class.java)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
@@ -332,7 +332,7 @@ class ReactiveMongoOperationsExtensionsTests {
|
||||
val collection = Mono.just(listOf(First(), First()))
|
||||
|
||||
operations.insertAll(collection, First::class)
|
||||
verify(operations, times(1)).insertAll(collection, First::class.java)
|
||||
verify(operations).insertAll(collection, First::class.java)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
@@ -342,7 +342,7 @@ class ReactiveMongoOperationsExtensionsTests {
|
||||
val update = mock<Update>()
|
||||
|
||||
operations.upsert(query, update, First::class)
|
||||
verify(operations, times(1)).upsert(query, update, First::class.java)
|
||||
verify(operations).upsert(query, update, First::class.java)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
@@ -353,7 +353,7 @@ class ReactiveMongoOperationsExtensionsTests {
|
||||
val collectionName = "foo"
|
||||
|
||||
operations.upsert(query, update, First::class, collectionName)
|
||||
verify(operations, times(1)).upsert(query, update, First::class.java, collectionName)
|
||||
verify(operations).upsert(query, update, First::class.java, collectionName)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
@@ -363,7 +363,7 @@ class ReactiveMongoOperationsExtensionsTests {
|
||||
val update = mock<Update>()
|
||||
|
||||
operations.upsert<First>(query, update)
|
||||
verify(operations, times(1)).upsert(query, update, First::class.java)
|
||||
verify(operations).upsert(query, update, First::class.java)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
@@ -374,7 +374,7 @@ class ReactiveMongoOperationsExtensionsTests {
|
||||
val collectionName = "foo"
|
||||
|
||||
operations.upsert<First>(query, update, collectionName)
|
||||
verify(operations, times(1)).upsert(query, update, First::class.java, collectionName)
|
||||
verify(operations).upsert(query, update, First::class.java, collectionName)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
@@ -384,7 +384,7 @@ class ReactiveMongoOperationsExtensionsTests {
|
||||
val update = mock<Update>()
|
||||
|
||||
operations.updateFirst(query, update, First::class)
|
||||
verify(operations, times(1)).updateFirst(query, update, First::class.java)
|
||||
verify(operations).updateFirst(query, update, First::class.java)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
@@ -395,7 +395,7 @@ class ReactiveMongoOperationsExtensionsTests {
|
||||
val collectionName = "foo"
|
||||
|
||||
operations.updateFirst(query, update, First::class, collectionName)
|
||||
verify(operations, times(1)).updateFirst(query, update, First::class.java, collectionName)
|
||||
verify(operations).updateFirst(query, update, First::class.java, collectionName)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
@@ -405,7 +405,7 @@ class ReactiveMongoOperationsExtensionsTests {
|
||||
val update = mock<Update>()
|
||||
|
||||
operations.updateFirst<First>(query, update)
|
||||
verify(operations, times(1)).updateFirst(query, update, First::class.java)
|
||||
verify(operations).updateFirst(query, update, First::class.java)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
@@ -416,7 +416,7 @@ class ReactiveMongoOperationsExtensionsTests {
|
||||
val collectionName = "foo"
|
||||
|
||||
operations.updateFirst<First>(query, update, collectionName)
|
||||
verify(operations, times(1)).updateFirst(query, update, First::class.java, collectionName)
|
||||
verify(operations).updateFirst(query, update, First::class.java, collectionName)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
@@ -426,7 +426,7 @@ class ReactiveMongoOperationsExtensionsTests {
|
||||
val update = mock<Update>()
|
||||
|
||||
operations.updateMulti(query, update, First::class)
|
||||
verify(operations, times(1)).updateMulti(query, update, First::class.java)
|
||||
verify(operations).updateMulti(query, update, First::class.java)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
@@ -437,7 +437,7 @@ class ReactiveMongoOperationsExtensionsTests {
|
||||
val collectionName = "foo"
|
||||
|
||||
operations.updateMulti(query, update, First::class, collectionName)
|
||||
verify(operations, times(1)).updateMulti(query, update, First::class.java, collectionName)
|
||||
verify(operations).updateMulti(query, update, First::class.java, collectionName)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
@@ -447,7 +447,7 @@ class ReactiveMongoOperationsExtensionsTests {
|
||||
val update = mock<Update>()
|
||||
|
||||
operations.updateMulti<First>(query, update)
|
||||
verify(operations, times(1)).updateMulti(query, update, First::class.java)
|
||||
verify(operations).updateMulti(query, update, First::class.java)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
@@ -458,7 +458,7 @@ class ReactiveMongoOperationsExtensionsTests {
|
||||
val collectionName = "foo"
|
||||
|
||||
operations.updateMulti<First>(query, update, collectionName)
|
||||
verify(operations, times(1)).updateMulti(query, update, First::class.java, collectionName)
|
||||
verify(operations).updateMulti(query, update, First::class.java, collectionName)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
@@ -467,7 +467,7 @@ class ReactiveMongoOperationsExtensionsTests {
|
||||
val query = mock<Query>()
|
||||
|
||||
operations.remove(query, First::class)
|
||||
verify(operations, times(1)).remove(query, First::class.java)
|
||||
verify(operations).remove(query, First::class.java)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
@@ -477,7 +477,7 @@ class ReactiveMongoOperationsExtensionsTests {
|
||||
val collectionName = "foo"
|
||||
|
||||
operations.remove(query, First::class, collectionName)
|
||||
verify(operations, times(1)).remove(query, First::class.java, collectionName)
|
||||
verify(operations).remove(query, First::class.java, collectionName)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
@@ -486,7 +486,7 @@ class ReactiveMongoOperationsExtensionsTests {
|
||||
val query = mock<Query>()
|
||||
|
||||
operations.remove<First>(query)
|
||||
verify(operations, times(1)).remove(query, First::class.java)
|
||||
verify(operations).remove(query, First::class.java)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
@@ -496,7 +496,7 @@ class ReactiveMongoOperationsExtensionsTests {
|
||||
val collectionName = "foo"
|
||||
|
||||
operations.remove<First>(query, collectionName)
|
||||
verify(operations, times(1)).remove(query, First::class.java, collectionName)
|
||||
verify(operations).remove(query, First::class.java, collectionName)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
@@ -505,7 +505,7 @@ class ReactiveMongoOperationsExtensionsTests {
|
||||
val query = mock<Query>()
|
||||
|
||||
operations.findAllAndRemove<First>(query)
|
||||
verify(operations, times(1)).findAllAndRemove(query, First::class.java)
|
||||
verify(operations).findAllAndRemove(query, First::class.java)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
@@ -514,7 +514,7 @@ class ReactiveMongoOperationsExtensionsTests {
|
||||
val query = mock<Query>()
|
||||
|
||||
operations.tail<First>(query)
|
||||
verify(operations, times(1)).tail(query, First::class.java)
|
||||
verify(operations).tail(query, First::class.java)
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1689
|
||||
@@ -524,6 +524,6 @@ class ReactiveMongoOperationsExtensionsTests {
|
||||
val collectionName = "foo"
|
||||
|
||||
operations.tail<First>(query, collectionName)
|
||||
verify(operations, times(1)).tail(query, First::class.java, collectionName)
|
||||
verify(operations).tail(query, First::class.java, collectionName)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user