DATACOUCH-273 - Adapt API changes after upgrade to Mockito 2.7.

This commit is contained in:
Oliver Gierke
2017-03-23 22:36:57 +01:00
committed by Mark Paluch
parent 439ab14131
commit 1fc4a05f37
21 changed files with 71 additions and 85 deletions

View File

@@ -1,10 +1,19 @@
package org.springframework.data.couchbase;
import static org.mockito.Mockito.when;
import static org.mockito.Mockito.*;
import java.util.Collections;
import java.util.List;
import org.mockito.Mockito;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.couchbase.config.AbstractCouchbaseConfiguration;
import org.springframework.data.couchbase.core.CouchbaseTemplate;
import org.springframework.data.couchbase.core.WriteResultChecking;
import org.springframework.data.couchbase.core.query.Consistency;
import org.springframework.data.couchbase.repository.support.IndexManager;
import com.couchbase.client.java.Bucket;
import com.couchbase.client.java.Cluster;
import com.couchbase.client.java.CouchbaseBucket;
@@ -13,15 +22,6 @@ import com.couchbase.client.java.cluster.ClusterInfo;
import com.couchbase.client.java.cluster.DefaultClusterInfo;
import com.couchbase.client.java.util.features.CouchbaseFeature;
import com.couchbase.client.java.util.features.Version;
import org.mockito.Mockito;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.couchbase.config.AbstractCouchbaseConfiguration;
import org.springframework.data.couchbase.core.CouchbaseTemplate;
import org.springframework.data.couchbase.core.WriteResultChecking;
import org.springframework.data.couchbase.core.query.Consistency;
import org.springframework.data.couchbase.repository.support.IndexManager;
@Configuration
public class UnitTestApplicationConfig extends AbstractCouchbaseConfiguration {

View File

@@ -17,22 +17,17 @@
package org.springframework.data.couchbase.config;
import static org.hamcrest.CoreMatchers.*;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.MatcherAssert.*;
import static org.hamcrest.core.Is.is;
import java.util.List;
import com.couchbase.client.java.env.CouchbaseEnvironment;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.config.ConstructorArgumentValues;
import org.springframework.beans.factory.config.RuntimeBeanReference;
import org.springframework.beans.factory.support.BeanDefinitionReader;
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
import org.springframework.beans.factory.support.GenericBeanDefinition;
import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
import org.springframework.core.io.ClassPathResource;

View File

@@ -17,16 +17,14 @@
package org.springframework.data.couchbase.config;
import static org.hamcrest.CoreMatchers.*;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.MatcherAssert.*;
import static org.hamcrest.core.Is.is;
import java.util.List;
import com.couchbase.client.java.env.CouchbaseEnvironment;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.config.ConstructorArgumentValues;
import org.springframework.beans.factory.config.RuntimeBeanReference;
@@ -36,6 +34,8 @@ import org.springframework.beans.factory.support.GenericBeanDefinition;
import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
import org.springframework.core.io.ClassPathResource;
import com.couchbase.client.java.env.CouchbaseEnvironment;
public class CouchbaseClusterParserTest {

View File

@@ -17,22 +17,22 @@
package org.springframework.data.couchbase.config;
import static org.hamcrest.CoreMatchers.*;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.*;
import com.couchbase.client.core.retry.BestEffortRetryStrategy;
import com.couchbase.client.core.retry.FailFastRetryStrategy;
import com.couchbase.client.java.env.CouchbaseEnvironment;
import com.couchbase.client.java.env.DefaultCouchbaseEnvironment;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import org.springframework.beans.factory.support.BeanDefinitionReader;
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
import org.springframework.context.support.GenericApplicationContext;
import org.springframework.core.io.ClassPathResource;
import com.couchbase.client.core.retry.BestEffortRetryStrategy;
import com.couchbase.client.core.retry.FailFastRetryStrategy;
import com.couchbase.client.java.env.CouchbaseEnvironment;
import com.couchbase.client.java.env.DefaultCouchbaseEnvironment;
public class CouchbaseEnvironmentParserTest {
private static GenericApplicationContext context;

View File

@@ -16,10 +16,8 @@
package org.springframework.data.couchbase.config;
import static org.hamcrest.CoreMatchers.instanceOf;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThat;
import static org.hamcrest.CoreMatchers.*;
import static org.junit.Assert.*;
import org.junit.Test;
import org.springframework.beans.factory.support.BeanDefinitionReader;

View File

@@ -17,6 +17,7 @@
package org.springframework.data.couchbase.core;
import org.springframework.data.annotation.Id;
import com.couchbase.client.java.repository.annotation.Field;

View File

@@ -17,6 +17,7 @@
package org.springframework.data.couchbase.core;
import org.springframework.data.annotation.Id;
import com.couchbase.client.java.repository.annotation.Field;

View File

@@ -16,12 +16,10 @@
package org.springframework.data.couchbase.core.convert.translation;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.*;
import org.junit.Before;
import org.junit.Test;
import org.springframework.data.couchbase.core.mapping.CouchbaseDocument;
/**

View File

@@ -16,15 +16,13 @@
package org.springframework.data.couchbase.core.mapping;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.*;
import java.lang.reflect.Field;
import java.util.Optional;
import org.junit.Before;
import org.junit.Test;
import org.springframework.data.annotation.Id;
import org.springframework.data.mapping.model.Property;
import org.springframework.data.mapping.model.PropertyNameFieldNamingStrategy;

View File

@@ -16,7 +16,7 @@
package org.springframework.data.couchbase.core.mapping;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.*;
import java.text.Format;
import java.text.SimpleDateFormat;
@@ -25,12 +25,9 @@ import java.util.Collections;
import java.util.Date;
import java.util.List;
import com.couchbase.client.java.repository.annotation.Field;
import com.couchbase.client.java.repository.annotation.Id;
import org.junit.After;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.convert.converter.Converter;
import org.springframework.data.convert.ReadingConverter;
@@ -41,6 +38,9 @@ import org.springframework.data.couchbase.core.convert.MappingCouchbaseConverter
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import com.couchbase.client.java.repository.annotation.Field;
import com.couchbase.client.java.repository.annotation.Id;
/**
* Tests to verify custom mapping logic.
*

View File

@@ -33,11 +33,9 @@ import java.util.Set;
import java.util.TreeMap;
import java.util.TreeSet;
import com.couchbase.client.java.repository.annotation.Field;
import org.joda.time.LocalDateTime;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.convert.converter.Converter;
import org.springframework.data.annotation.Id;
@@ -50,6 +48,8 @@ import org.springframework.data.mapping.model.MappingException;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import com.couchbase.client.java.repository.annotation.Field;
/**
* @author Michael Nitschinger
* @author Geoffrey Mina

View File

@@ -16,11 +16,10 @@
package org.springframework.data.couchbase.core.mapping.event;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.*;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.couchbase.core.CouchbaseTemplate;
import org.springframework.test.context.ContextConfiguration;

View File

@@ -16,15 +16,13 @@
package org.springframework.data.couchbase.core.mapping.event;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.fail;
import static org.hamcrest.CoreMatchers.*;
import static org.junit.Assert.*;
import javax.validation.ConstraintViolationException;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.couchbase.core.CouchbaseTemplate;
import org.springframework.test.context.ContextConfiguration;

View File

@@ -1,26 +1,16 @@
package org.springframework.data.couchbase.repository;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import static org.mockito.Matchers.any;
import static org.junit.Assert.*;
import static org.mockito.ArgumentMatchers.*;
import static org.mockito.Mockito.*;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import com.couchbase.client.java.Bucket;
import com.couchbase.client.java.document.json.JsonObject;
import com.couchbase.client.java.error.DocumentDoesNotExistException;
import com.couchbase.client.java.query.N1qlQuery;
import com.couchbase.client.java.view.ViewQuery;
import com.couchbase.client.java.view.ViewResult;
import com.couchbase.client.java.view.ViewRow;
import org.junit.Before;
import org.junit.Test;
import org.mockito.ArgumentCaptor;
import org.springframework.dao.DataRetrievalFailureException;
import org.springframework.data.couchbase.core.CouchbaseOperations;
import org.springframework.data.couchbase.core.convert.CouchbaseConverter;
@@ -31,6 +21,14 @@ import org.springframework.data.couchbase.repository.support.ViewMetadataProvide
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort;
import com.couchbase.client.java.Bucket;
import com.couchbase.client.java.document.json.JsonObject;
import com.couchbase.client.java.error.DocumentDoesNotExistException;
import com.couchbase.client.java.query.N1qlQuery;
import com.couchbase.client.java.view.ViewQuery;
import com.couchbase.client.java.view.ViewResult;
import com.couchbase.client.java.view.ViewRow;
public class RepositoryIndexUsageTest {
private static final org.springframework.data.couchbase.core.query.Consistency CONSISTENCY = Consistency.STRONGLY_CONSISTENT;

View File

@@ -15,8 +15,9 @@
*/
package org.springframework.data.couchbase.repository.query;
import static com.couchbase.client.java.query.Select.select;
import static com.couchbase.client.java.query.Select.*;
import static org.junit.Assert.*;
import static org.mockito.ArgumentMatchers.*;
import static org.mockito.Mockito.*;
import java.lang.reflect.Method;
@@ -26,14 +27,6 @@ import java.util.List;
import java.util.concurrent.CountDownLatch;
import java.util.stream.Stream;
import com.couchbase.client.java.document.json.JsonArray;
import com.couchbase.client.java.document.json.JsonObject;
import com.couchbase.client.java.query.ParameterizedN1qlQuery;
import com.couchbase.client.java.query.N1qlQuery;
import com.couchbase.client.java.query.N1qlParams;
import com.couchbase.client.java.query.SimpleN1qlQuery;
import com.couchbase.client.java.query.Statement;
import com.couchbase.client.java.query.consistency.ScanConsistency;
import org.junit.Test;
import org.mockito.Mockito;
import org.springframework.data.couchbase.core.mapping.CouchbaseMappingContext;
@@ -47,6 +40,15 @@ import org.springframework.data.repository.core.RepositoryMetadata;
import org.springframework.data.repository.core.support.DefaultRepositoryMetadata;
import org.springframework.data.repository.query.QueryMethod;
import com.couchbase.client.java.document.json.JsonArray;
import com.couchbase.client.java.document.json.JsonObject;
import com.couchbase.client.java.query.N1qlParams;
import com.couchbase.client.java.query.N1qlQuery;
import com.couchbase.client.java.query.ParameterizedN1qlQuery;
import com.couchbase.client.java.query.SimpleN1qlQuery;
import com.couchbase.client.java.query.Statement;
import com.couchbase.client.java.query.consistency.ScanConsistency;
/**
* Unit tests for {@link AbstractN1qlBasedQuery}.
*

View File

@@ -1,17 +1,17 @@
package org.springframework.data.couchbase.repository.query;
import static org.junit.Assert.assertEquals;
import static org.springframework.data.couchbase.repository.query.N1qlQueryCreator.createExpression;
import static org.junit.Assert.*;
import static org.springframework.data.couchbase.repository.query.N1qlQueryCreator.*;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import com.couchbase.client.java.query.dsl.Expression;
import org.junit.Test;
import org.springframework.data.repository.query.parser.Part;
import com.couchbase.client.java.query.dsl.Expression;
public class N1qlQueryCreatorTest {
//==== The tests below check mapping between a Part.Type and the corresponding N1QL expression ====

View File

@@ -1,7 +1,7 @@
package org.springframework.data.couchbase.repository.query;
import static org.junit.Assert.*;
import static org.mockito.Matchers.*;
import static org.mockito.ArgumentMatchers.*;
import static org.mockito.Mockito.*;
import java.lang.reflect.Method;
@@ -11,20 +11,20 @@ import java.util.List;
import java.util.Optional;
import org.junit.Test;
import org.springframework.data.couchbase.core.BeerDTO;
import org.springframework.data.couchbase.core.mapping.CouchbaseMappingContext;
import org.springframework.data.mapping.*;
import org.springframework.core.convert.converter.Converter;
import org.springframework.data.couchbase.core.Beer;
import org.springframework.data.couchbase.core.BeerDTO;
import org.springframework.data.couchbase.core.BeerProjection;
import org.springframework.data.couchbase.core.CouchbaseOperations;
import org.springframework.data.couchbase.core.convert.CouchbaseConverter;
import org.springframework.data.couchbase.core.mapping.CouchbaseMappingContext;
import org.springframework.data.couchbase.core.mapping.CouchbasePersistentProperty;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.data.domain.Sort.Direction;
import org.springframework.data.mapping.PropertyPath;
import org.springframework.data.mapping.context.MappingContext;
import org.springframework.data.mapping.context.PersistentPropertyPath;
import org.springframework.data.projection.ProjectionFactory;
@@ -34,10 +34,10 @@ import org.springframework.data.repository.core.EntityMetadata;
import org.springframework.data.repository.core.RepositoryMetadata;
import org.springframework.data.repository.core.support.DefaultRepositoryMetadata;
import org.springframework.data.repository.query.ParameterAccessor;
import org.springframework.data.repository.query.ResultProcessor;
import com.couchbase.client.java.CouchbaseBucket;
import com.couchbase.client.java.query.Statement;
import org.springframework.data.repository.query.ResultProcessor;
public class PartTreeN1qBasedQueryTest {

View File

@@ -1,12 +1,12 @@
package org.springframework.data.couchbase.repository.query;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.*;
import static org.springframework.data.couchbase.repository.query.StringBasedN1qlQueryParser.*;
import org.junit.Test;
import org.springframework.expression.EvaluationContext;
import org.springframework.expression.spel.standard.SpelExpressionParser;
import org.springframework.expression.spel.support.StandardEvaluationContext;
import static org.springframework.data.couchbase.repository.query.StringBasedN1qlQueryParser.*;
public class StringN1QlBasedQueryTest {
private static final SpelExpressionParser SPEL_PARSER = new SpelExpressionParser();

View File

@@ -8,7 +8,6 @@ import java.util.List;
import org.junit.Before;
import org.junit.Test;
import org.springframework.core.convert.converter.Converter;
import org.springframework.data.geo.Circle;
import org.springframework.data.geo.Distance;

View File

@@ -1,10 +1,8 @@
package org.springframework.data.couchbase.repository.query.support;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.*;
import com.couchbase.client.java.document.json.JsonArray;
import org.junit.Test;
import org.springframework.data.geo.Box;
import org.springframework.data.geo.Circle;
import org.springframework.data.geo.Distance;
@@ -12,6 +10,8 @@ import org.springframework.data.geo.Point;
import org.springframework.data.geo.Polygon;
import org.springframework.data.geo.Shape;
import com.couchbase.client.java.document.json.JsonArray;
/**
* Unit tests for the {@link GeoUtils} utility class.
* @author Simon Baslé

View File

@@ -1,12 +1,11 @@
package org.springframework.data.couchbase.repository.query.support;
import static com.couchbase.client.java.query.dsl.Expression.*;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.*;
import static org.mockito.Mockito.*;
import org.junit.Ignore;
import org.junit.Test;
import org.springframework.data.couchbase.core.Beer;
import org.springframework.data.couchbase.core.convert.CouchbaseConverter;
import org.springframework.data.couchbase.core.mapping.CouchbaseMappingContext;