diff --git a/src/main/java/org/springframework/data/keyvalue/core/DefaultIdentifierGenerator.java b/src/main/java/org/springframework/data/keyvalue/core/DefaultIdentifierGenerator.java index 2fcd6e2..e897aac 100644 --- a/src/main/java/org/springframework/data/keyvalue/core/DefaultIdentifierGenerator.java +++ b/src/main/java/org/springframework/data/keyvalue/core/DefaultIdentifierGenerator.java @@ -56,7 +56,7 @@ enum DefaultIdentifierGenerator implements IdentifierGenerator { } throw new InvalidDataAccessApiUsageException( - String.format("Identifier cannot be generated for %s. Supported types are: UUID, String, Integer, and Long.", + String.format("Identifier cannot be generated for %s; Supported types are: UUID, String, Integer, and Long", identifierType.getType().getName())); } @@ -77,7 +77,7 @@ enum DefaultIdentifierGenerator implements IdentifierGenerator { if (secureRandom == null) { throw new InvalidDataAccessApiUsageException( - String.format("Could not create SecureRandom instance for one of the algorithms '%s'.", + String.format("Could not create SecureRandom instance for one of the algorithms '%s'", StringUtils.collectionToCommaDelimitedString(OsTools.secureRandomAlgorithmNames()))); } diff --git a/src/main/java/org/springframework/data/keyvalue/core/ForwardingCloseableIterator.java b/src/main/java/org/springframework/data/keyvalue/core/ForwardingCloseableIterator.java index 258e7b2..f593912 100644 --- a/src/main/java/org/springframework/data/keyvalue/core/ForwardingCloseableIterator.java +++ b/src/main/java/org/springframework/data/keyvalue/core/ForwardingCloseableIterator.java @@ -52,7 +52,7 @@ public class ForwardingCloseableIterator implements CloseableIterator { */ public ForwardingCloseableIterator(Iterator delegate, @Nullable Runnable closeHandler) { - Assert.notNull(delegate, "Delegate iterator must not be null!"); + Assert.notNull(delegate, "Delegate iterator must not be null"); this.delegate = delegate; this.closeHandler = closeHandler; diff --git a/src/main/java/org/springframework/data/keyvalue/core/GeneratingIdAccessor.java b/src/main/java/org/springframework/data/keyvalue/core/GeneratingIdAccessor.java index a76de80..d1293d1 100644 --- a/src/main/java/org/springframework/data/keyvalue/core/GeneratingIdAccessor.java +++ b/src/main/java/org/springframework/data/keyvalue/core/GeneratingIdAccessor.java @@ -45,9 +45,9 @@ class GeneratingIdAccessor implements IdentifierAccessor { GeneratingIdAccessor(PersistentPropertyAccessor accessor, PersistentProperty identifierProperty, IdentifierGenerator generator) { - Assert.notNull(accessor, "PersistentPropertyAccessor must not be null!"); - Assert.notNull(identifierProperty, "Identifier property must not be null!"); - Assert.notNull(generator, "IdentifierGenerator must not be null!"); + Assert.notNull(accessor, "PersistentPropertyAccessor must not be null"); + Assert.notNull(identifierProperty, "Identifier property must not be null"); + Assert.notNull(generator, "IdentifierGenerator must not be null"); this.accessor = accessor; this.identifierProperty = identifierProperty; diff --git a/src/main/java/org/springframework/data/keyvalue/core/KeyValuePersistenceExceptionTranslator.java b/src/main/java/org/springframework/data/keyvalue/core/KeyValuePersistenceExceptionTranslator.java index c5fb785..03642df 100644 --- a/src/main/java/org/springframework/data/keyvalue/core/KeyValuePersistenceExceptionTranslator.java +++ b/src/main/java/org/springframework/data/keyvalue/core/KeyValuePersistenceExceptionTranslator.java @@ -36,7 +36,7 @@ public class KeyValuePersistenceExceptionTranslator implements PersistenceExcept @Override public DataAccessException translateExceptionIfPossible(RuntimeException exception) { - Assert.notNull(exception, "Exception must not be null!"); + Assert.notNull(exception, "Exception must not be null"); if (exception instanceof DataAccessException) { return (DataAccessException) exception; diff --git a/src/main/java/org/springframework/data/keyvalue/core/KeyValueTemplate.java b/src/main/java/org/springframework/data/keyvalue/core/KeyValueTemplate.java index eb09c24..aa29618 100644 --- a/src/main/java/org/springframework/data/keyvalue/core/KeyValueTemplate.java +++ b/src/main/java/org/springframework/data/keyvalue/core/KeyValueTemplate.java @@ -96,9 +96,9 @@ public class KeyValueTemplate implements KeyValueOperations, ApplicationEventPub MappingContext, ? extends KeyValuePersistentProperty> mappingContext, IdentifierGenerator identifierGenerator) { - Assert.notNull(adapter, "Adapter must not be null!"); - Assert.notNull(mappingContext, "MappingContext must not be null!"); - Assert.notNull(identifierGenerator, "IdentifierGenerator must not be null!"); + Assert.notNull(adapter, "Adapter must not be null"); + Assert.notNull(mappingContext, "MappingContext must not be null"); + Assert.notNull(identifierGenerator, "IdentifierGenerator must not be null"); this.adapter = adapter; this.mappingContext = mappingContext; @@ -112,7 +112,7 @@ public class KeyValueTemplate implements KeyValueOperations, ApplicationEventPub */ public void setExceptionTranslator(PersistenceExceptionTranslator exceptionTranslator) { - Assert.notNull(exceptionTranslator, "ExceptionTranslator must not be null!"); + Assert.notNull(exceptionTranslator, "ExceptionTranslator must not be null"); this.exceptionTranslator = exceptionTranslator; } @@ -152,8 +152,8 @@ public class KeyValueTemplate implements KeyValueOperations, ApplicationEventPub @Override public T insert(Object id, T objectToInsert) { - Assert.notNull(id, "Id for object to be inserted must not be null!"); - Assert.notNull(objectToInsert, "Object to be inserted must not be null!"); + Assert.notNull(id, "Id for object to be inserted must not be null"); + Assert.notNull(objectToInsert, "Object to be inserted must not be null"); String keyspace = resolveKeySpace(objectToInsert.getClass()); @@ -163,7 +163,7 @@ public class KeyValueTemplate implements KeyValueOperations, ApplicationEventPub if (adapter.contains(id, keyspace)) { throw new DuplicateKeyException( - String.format("Cannot insert existing object with id %s!. Please use update.", id)); + String.format("Cannot insert existing object with id %s; Please use update", id)); } adapter.put(id, objectToInsert, keyspace); @@ -191,8 +191,8 @@ public class KeyValueTemplate implements KeyValueOperations, ApplicationEventPub @Override public T update(Object id, T objectToUpdate) { - Assert.notNull(id, "Id for object to be inserted must not be null!"); - Assert.notNull(objectToUpdate, "Object to be updated must not be null!"); + Assert.notNull(id, "Id for object to be inserted must not be null"); + Assert.notNull(objectToUpdate, "Object to be updated must not be null"); String keyspace = resolveKeySpace(objectToUpdate.getClass()); @@ -209,7 +209,7 @@ public class KeyValueTemplate implements KeyValueOperations, ApplicationEventPub @Override public Iterable findAll(Class type) { - Assert.notNull(type, "Type to fetch must not be null!"); + Assert.notNull(type, "Type to fetch must not be null"); return executeRequired(adapter -> { @@ -229,8 +229,8 @@ public class KeyValueTemplate implements KeyValueOperations, ApplicationEventPub @Override public Optional findById(Object id, Class type) { - Assert.notNull(id, "Id for object to be found must not be null!"); - Assert.notNull(type, "Type to fetch must not be null!"); + Assert.notNull(id, "Id for object to be found must not be null"); + Assert.notNull(type, "Type to fetch must not be null"); String keyspace = resolveKeySpace(type); @@ -255,7 +255,7 @@ public class KeyValueTemplate implements KeyValueOperations, ApplicationEventPub @Override public void delete(Class type) { - Assert.notNull(type, "Type to delete must not be null!"); + Assert.notNull(type, "Type to delete must not be null"); String keyspace = resolveKeySpace(type); @@ -283,8 +283,8 @@ public class KeyValueTemplate implements KeyValueOperations, ApplicationEventPub @Override public T delete(Object id, Class type) { - Assert.notNull(id, "Id for object to be deleted must not be null!"); - Assert.notNull(type, "Type to delete must not be null!"); + Assert.notNull(id, "Id for object to be deleted must not be null"); + Assert.notNull(type, "Type to delete must not be null"); String keyspace = resolveKeySpace(type); @@ -300,7 +300,7 @@ public class KeyValueTemplate implements KeyValueOperations, ApplicationEventPub @Override public long count(Class type) { - Assert.notNull(type, "Type for count must not be null!"); + Assert.notNull(type, "Type for count must not be null"); return adapter.count(resolveKeySpace(type)); } @@ -308,7 +308,7 @@ public class KeyValueTemplate implements KeyValueOperations, ApplicationEventPub @Override public T execute(KeyValueCallback action) { - Assert.notNull(action, "KeyValueCallback must not be null!"); + Assert.notNull(action, "KeyValueCallback must not be null"); try { return action.doInKeyValue(this.adapter); @@ -332,7 +332,7 @@ public class KeyValueTemplate implements KeyValueOperations, ApplicationEventPub return result; } - throw new IllegalStateException(String.format("KeyValueCallback %s returned null value!", action)); + throw new IllegalStateException(String.format("KeyValueCallback %s returned null value", action)); } @Override diff --git a/src/main/java/org/springframework/data/keyvalue/core/QueryEngine.java b/src/main/java/org/springframework/data/keyvalue/core/QueryEngine.java index c2ae856..85bb4e0 100644 --- a/src/main/java/org/springframework/data/keyvalue/core/QueryEngine.java +++ b/src/main/java/org/springframework/data/keyvalue/core/QueryEngine.java @@ -144,7 +144,7 @@ public abstract class QueryEngine { */ public SpelCriteriaAccessor(SpelExpressionParser parser) { - Assert.notNull(parser, "SpelExpressionParser must not be null!"); + Assert.notNull(parser, "SpelExpressionParser must not be null"); this.parser = parser; } diff --git a/src/main/java/org/springframework/data/keyvalue/core/SpelPropertyComparator.java b/src/main/java/org/springframework/data/keyvalue/core/SpelPropertyComparator.java index 71caeac..a6b398f 100644 --- a/src/main/java/org/springframework/data/keyvalue/core/SpelPropertyComparator.java +++ b/src/main/java/org/springframework/data/keyvalue/core/SpelPropertyComparator.java @@ -47,8 +47,8 @@ public class SpelPropertyComparator implements Comparator { */ public SpelPropertyComparator(String path, SpelExpressionParser parser) { - Assert.hasText(path, "Path must not be null or empty!"); - Assert.notNull(parser, "SpelExpressionParser must not be null!"); + Assert.hasText(path, "Path must not be null or empty"); + Assert.notNull(parser, "SpelExpressionParser must not be null"); this.path = path; this.parser = parser; diff --git a/src/main/java/org/springframework/data/keyvalue/core/SpelSortAccessor.java b/src/main/java/org/springframework/data/keyvalue/core/SpelSortAccessor.java index 2b2fc7d..32ae6e2 100644 --- a/src/main/java/org/springframework/data/keyvalue/core/SpelSortAccessor.java +++ b/src/main/java/org/springframework/data/keyvalue/core/SpelSortAccessor.java @@ -43,7 +43,7 @@ public class SpelSortAccessor implements SortAccessor> { */ public SpelSortAccessor(SpelExpressionParser parser) { - Assert.notNull(parser, "SpelExpressionParser must not be null!"); + Assert.notNull(parser, "SpelExpressionParser must not be null"); this.parser = parser; } diff --git a/src/main/java/org/springframework/data/keyvalue/core/mapping/AnnotationBasedKeySpaceResolver.java b/src/main/java/org/springframework/data/keyvalue/core/mapping/AnnotationBasedKeySpaceResolver.java index 03735ff..3b7dfcc 100644 --- a/src/main/java/org/springframework/data/keyvalue/core/mapping/AnnotationBasedKeySpaceResolver.java +++ b/src/main/java/org/springframework/data/keyvalue/core/mapping/AnnotationBasedKeySpaceResolver.java @@ -39,7 +39,7 @@ enum AnnotationBasedKeySpaceResolver implements KeySpaceResolver { @Nullable public String resolveKeySpace(Class type) { - Assert.notNull(type, "Type for keyspace for null!"); + Assert.notNull(type, "Type for keyspace for null"); Class userClass = ClassUtils.getUserClass(type); Object keySpace = getKeySpace(userClass); diff --git a/src/main/java/org/springframework/data/keyvalue/core/mapping/ClassNameKeySpaceResolver.java b/src/main/java/org/springframework/data/keyvalue/core/mapping/ClassNameKeySpaceResolver.java index 7237c94..f329778 100644 --- a/src/main/java/org/springframework/data/keyvalue/core/mapping/ClassNameKeySpaceResolver.java +++ b/src/main/java/org/springframework/data/keyvalue/core/mapping/ClassNameKeySpaceResolver.java @@ -31,7 +31,7 @@ enum ClassNameKeySpaceResolver implements KeySpaceResolver { @Override public String resolveKeySpace(Class type) { - Assert.notNull(type, "Type must not be null!"); + Assert.notNull(type, "Type must not be null"); return ClassUtils.getUserClass(type).getName(); } } diff --git a/src/main/java/org/springframework/data/keyvalue/core/query/KeyValueQuery.java b/src/main/java/org/springframework/data/keyvalue/core/query/KeyValueQuery.java index 65a0dca..e5b87df 100644 --- a/src/main/java/org/springframework/data/keyvalue/core/query/KeyValueQuery.java +++ b/src/main/java/org/springframework/data/keyvalue/core/query/KeyValueQuery.java @@ -133,7 +133,7 @@ public class KeyValueQuery { */ public void setSort(Sort sort) { - Assert.notNull(sort, "Sort must not be null!"); + Assert.notNull(sort, "Sort must not be null"); this.sort = sort; } @@ -146,7 +146,7 @@ public class KeyValueQuery { */ public KeyValueQuery orderBy(Sort sort) { - Assert.notNull(sort, "Sort must not be null!"); + Assert.notNull(sort, "Sort must not be null"); if (this.sort.isSorted()) { this.sort = this.sort.and(sort); diff --git a/src/main/java/org/springframework/data/keyvalue/repository/query/KeyValuePartTreeQuery.java b/src/main/java/org/springframework/data/keyvalue/repository/query/KeyValuePartTreeQuery.java index d73fe88..1768b8d 100644 --- a/src/main/java/org/springframework/data/keyvalue/repository/query/KeyValuePartTreeQuery.java +++ b/src/main/java/org/springframework/data/keyvalue/repository/query/KeyValuePartTreeQuery.java @@ -88,10 +88,10 @@ public class KeyValuePartTreeQuery implements RepositoryQuery { KeyValueOperations keyValueOperations, QueryCreatorFactory, ?>> queryCreatorFactory) { - Assert.notNull(queryMethod, "Query method must not be null!"); - Assert.notNull(evaluationContextProvider, "EvaluationContextprovider must not be null!"); - Assert.notNull(keyValueOperations, "KeyValueOperations must not be null!"); - Assert.notNull(queryCreatorFactory, "QueryCreatorFactory type must not be null!"); + Assert.notNull(queryMethod, "Query method must not be null"); + Assert.notNull(evaluationContextProvider, "EvaluationContextprovider must not be null"); + Assert.notNull(keyValueOperations, "KeyValueOperations must not be null"); + Assert.notNull(queryCreatorFactory, "QueryCreatorFactory type must not be null"); this.partTree = Lazy .of(() -> new PartTree(queryMethod.getName(), queryMethod.getEntityInformation().getJavaType())); @@ -142,7 +142,7 @@ public class KeyValuePartTreeQuery implements RepositoryQuery { return keyValueOperations.exists(query, queryMethod.getEntityInformation().getJavaType()); } - throw new UnsupportedOperationException("Query method not supported."); + throw new UnsupportedOperationException("Query method not supported"); } protected KeyValueQuery prepareQuery(Object[] parameters) { @@ -258,7 +258,7 @@ public class KeyValuePartTreeQuery implements RepositoryQuery { public AbstractQueryCreator, ?> queryCreatorFor(PartTree partTree, ParameterAccessor accessor) { Assert.state(constructor != null, - () -> String.format("No constructor (PartTree, ParameterAccessor) could be found on type %s!", type)); + () -> String.format("No constructor (PartTree, ParameterAccessor) could be found on type %s", type)); return (AbstractQueryCreator, ?>) BeanUtils.instantiateClass(constructor, partTree, accessor); } } diff --git a/src/main/java/org/springframework/data/keyvalue/repository/query/SpelQueryCreator.java b/src/main/java/org/springframework/data/keyvalue/repository/query/SpelQueryCreator.java index 5c06d7e..0abc4c7 100644 --- a/src/main/java/org/springframework/data/keyvalue/repository/query/SpelQueryCreator.java +++ b/src/main/java/org/springframework/data/keyvalue/repository/query/SpelQueryCreator.java @@ -107,7 +107,7 @@ public class SpelQueryCreator extends AbstractQueryCreator[] toOrderSpecifier(Sort sort, PathBuilder builder) { - Assert.notNull(sort, "Sort must not be null!"); - Assert.notNull(builder, "Builder must not be null!"); + Assert.notNull(sort, "Sort must not be null"); + Assert.notNull(builder, "Builder must not be null"); List> specifiers = null; @@ -88,8 +88,8 @@ abstract class KeyValueQuerydslUtils { */ private static Expression buildOrderPropertyPathFrom(Order order, PathBuilder builder) { - Assert.notNull(order, "Order must not be null!"); - Assert.notNull(builder, "Builder must not be null!"); + Assert.notNull(order, "Order must not be null"); + Assert.notNull(builder, "Builder must not be null"); PropertyPath path = PropertyPath.from(order.getProperty(), builder.getType()); Expression sortPropertyExpression = builder; @@ -118,7 +118,7 @@ abstract class KeyValueQuerydslUtils { */ private static NullHandling toQueryDslNullHandling(org.springframework.data.domain.Sort.NullHandling nullHandling) { - Assert.notNull(nullHandling, "NullHandling must not be null!"); + Assert.notNull(nullHandling, "NullHandling must not be null"); switch (nullHandling) { diff --git a/src/main/java/org/springframework/data/keyvalue/repository/support/KeyValueRepositoryFactory.java b/src/main/java/org/springframework/data/keyvalue/repository/support/KeyValueRepositoryFactory.java index a471131..874dfdd 100644 --- a/src/main/java/org/springframework/data/keyvalue/repository/support/KeyValueRepositoryFactory.java +++ b/src/main/java/org/springframework/data/keyvalue/repository/support/KeyValueRepositoryFactory.java @@ -99,9 +99,9 @@ public class KeyValueRepositoryFactory extends RepositoryFactorySupport { public KeyValueRepositoryFactory(KeyValueOperations keyValueOperations, Class> queryCreator, Class repositoryQueryType) { - Assert.notNull(keyValueOperations, "KeyValueOperations must not be null!"); - Assert.notNull(queryCreator, "Query creator type must not be null!"); - Assert.notNull(repositoryQueryType, "RepositoryQueryType type must not be null!"); + Assert.notNull(keyValueOperations, "KeyValueOperations must not be null"); + Assert.notNull(queryCreator, "Query creator type must not be null"); + Assert.notNull(repositoryQueryType, "RepositoryQueryType type must not be null"); this.queryCreator = queryCreator; this.keyValueOperations = keyValueOperations; @@ -204,10 +204,10 @@ public class KeyValueRepositoryFactory extends RepositoryFactorySupport { Class> queryCreator, Class repositoryQueryType) { - Assert.notNull(evaluationContextProvider, "EvaluationContextProvider must not be null!"); - Assert.notNull(keyValueOperations, "KeyValueOperations must not be null!"); - Assert.notNull(queryCreator, "Query creator type must not be null!"); - Assert.notNull(repositoryQueryType, "RepositoryQueryType type must not be null!"); + Assert.notNull(evaluationContextProvider, "EvaluationContextProvider must not be null"); + Assert.notNull(keyValueOperations, "KeyValueOperations must not be null"); + Assert.notNull(queryCreator, "Query creator type must not be null"); + Assert.notNull(repositoryQueryType, "RepositoryQueryType type must not be null"); this.evaluationContextProvider = evaluationContextProvider; this.keyValueOperations = keyValueOperations; @@ -228,7 +228,7 @@ public class KeyValueRepositoryFactory extends RepositoryFactorySupport { Assert.state(constructor != null, String.format( - "Constructor %s(QueryMethod, EvaluationContextProvider, KeyValueOperations, Class) not available!", + "Constructor %s(QueryMethod, EvaluationContextProvider, KeyValueOperations, Class) not available", ClassUtils.getShortName(this.repositoryQueryType))); return BeanUtils.instantiateClass(constructor, queryMethod, evaluationContextProvider, this.keyValueOperations, diff --git a/src/main/java/org/springframework/data/keyvalue/repository/support/KeyValueRepositoryFactoryBean.java b/src/main/java/org/springframework/data/keyvalue/repository/support/KeyValueRepositoryFactoryBean.java index c8feabe..7c34c9c 100644 --- a/src/main/java/org/springframework/data/keyvalue/repository/support/KeyValueRepositoryFactoryBean.java +++ b/src/main/java/org/springframework/data/keyvalue/repository/support/KeyValueRepositoryFactoryBean.java @@ -57,7 +57,7 @@ public class KeyValueRepositoryFactoryBean, S, ID> */ public void setKeyValueOperations(KeyValueOperations operations) { - Assert.notNull(operations, "KeyValueOperations must not be null!"); + Assert.notNull(operations, "KeyValueOperations must not be null"); this.operations = operations; } @@ -74,7 +74,7 @@ public class KeyValueRepositoryFactoryBean, S, ID> */ public void setQueryCreator(Class> queryCreator) { - Assert.notNull(queryCreator, "Query creator type must not be null!"); + Assert.notNull(queryCreator, "Query creator type must not be null"); this.queryCreator = queryCreator; } @@ -87,7 +87,7 @@ public class KeyValueRepositoryFactoryBean, S, ID> */ public void setQueryType(Class repositoryQueryType) { - Assert.notNull(queryCreator, "Query creator type must not be null!"); + Assert.notNull(queryCreator, "Query creator type must not be null"); this.repositoryQueryType = repositoryQueryType; @@ -116,9 +116,9 @@ public class KeyValueRepositoryFactoryBean, S, ID> @Override public void afterPropertiesSet() { - Assert.notNull(operations, "KeyValueOperations must not be null!"); - Assert.notNull(queryCreator, "Query creator type must not be null!"); - Assert.notNull(repositoryQueryType, "RepositoryQueryType type type must not be null!"); + Assert.notNull(operations, "KeyValueOperations must not be null"); + Assert.notNull(queryCreator, "Query creator type must not be null"); + Assert.notNull(repositoryQueryType, "RepositoryQueryType type type must not be null"); super.afterPropertiesSet(); } diff --git a/src/main/java/org/springframework/data/keyvalue/repository/support/QuerydslKeyValuePredicateExecutor.java b/src/main/java/org/springframework/data/keyvalue/repository/support/QuerydslKeyValuePredicateExecutor.java index 627bc40..f739236 100644 --- a/src/main/java/org/springframework/data/keyvalue/repository/support/QuerydslKeyValuePredicateExecutor.java +++ b/src/main/java/org/springframework/data/keyvalue/repository/support/QuerydslKeyValuePredicateExecutor.java @@ -98,10 +98,10 @@ public class QuerydslKeyValuePredicateExecutor implements ListQuerydslPredica ProjectionFactory projectionFactory, KeyValueOperations operations, EntityPathResolver resolver) { - Assert.notNull(entityInformation, "EntityInformation must not be null!"); - Assert.notNull(projectionFactory, "ProjectionFactory must not be null!"); - Assert.notNull(operations, "KeyValueOperations must not be null!"); - Assert.notNull(resolver, "EntityPathResolver must not be null!"); + Assert.notNull(entityInformation, "EntityInformation must not be null"); + Assert.notNull(projectionFactory, "ProjectionFactory must not be null"); + Assert.notNull(operations, "KeyValueOperations must not be null"); + Assert.notNull(resolver, "EntityPathResolver must not be null"); this.projectionFactory = projectionFactory; this.context = operations.getMappingContext(); @@ -114,19 +114,19 @@ public class QuerydslKeyValuePredicateExecutor implements ListQuerydslPredica @Override public Optional findOne(Predicate predicate) { - Assert.notNull(predicate, "Predicate must not be null!"); + Assert.notNull(predicate, "Predicate must not be null"); try { return Optional.ofNullable(prepareQuery(predicate).fetchOne()); } catch (NonUniqueResultException o_O) { - throw new IncorrectResultSizeDataAccessException("Expected one or no result but found more than one!", 1, o_O); + throw new IncorrectResultSizeDataAccessException("Expected one or no result but found more than one", 1, o_O); } } @Override public List findAll(Predicate predicate) { - Assert.notNull(predicate, "Predicate must not be null!"); + Assert.notNull(predicate, "Predicate must not be null"); return prepareQuery(predicate).fetchResults().getResults(); } @@ -134,8 +134,8 @@ public class QuerydslKeyValuePredicateExecutor implements ListQuerydslPredica @Override public List findAll(Predicate predicate, OrderSpecifier... orders) { - Assert.notNull(predicate, "Predicate must not be null!"); - Assert.notNull(orders, "OrderSpecifiers must not be null!"); + Assert.notNull(predicate, "Predicate must not be null"); + Assert.notNull(orders, "OrderSpecifiers must not be null"); AbstractCollQuery query = prepareQuery(predicate); query.orderBy(orders); @@ -146,8 +146,8 @@ public class QuerydslKeyValuePredicateExecutor implements ListQuerydslPredica @Override public List findAll(Predicate predicate, Sort sort) { - Assert.notNull(predicate, "Predicate must not be null!"); - Assert.notNull(sort, "Sort must not be null!"); + Assert.notNull(predicate, "Predicate must not be null"); + Assert.notNull(sort, "Sort must not be null"); return findAll(predicate, toOrderSpecifier(sort, builder)); } @@ -155,8 +155,8 @@ public class QuerydslKeyValuePredicateExecutor implements ListQuerydslPredica @Override public Page findAll(Predicate predicate, Pageable pageable) { - Assert.notNull(predicate, "Predicate must not be null!"); - Assert.notNull(pageable, "Pageable must not be null!"); + Assert.notNull(predicate, "Predicate must not be null"); + Assert.notNull(pageable, "Pageable must not be null"); AbstractCollQuery query = prepareQuery(predicate); @@ -176,7 +176,7 @@ public class QuerydslKeyValuePredicateExecutor implements ListQuerydslPredica @Override public List findAll(OrderSpecifier... orders) { - Assert.notNull(orders, "OrderSpecifiers must not be null!"); + Assert.notNull(orders, "OrderSpecifiers must not be null"); if (orders.length == 0) { return findAll.get(); @@ -191,7 +191,7 @@ public class QuerydslKeyValuePredicateExecutor implements ListQuerydslPredica @Override public long count(Predicate predicate) { - Assert.notNull(predicate, "Predicate must not be null!"); + Assert.notNull(predicate, "Predicate must not be null"); return prepareQuery(predicate).fetchCount(); } @@ -199,7 +199,7 @@ public class QuerydslKeyValuePredicateExecutor implements ListQuerydslPredica @Override public boolean exists(Predicate predicate) { - Assert.notNull(predicate, "Predicate must not be null!"); + Assert.notNull(predicate, "Predicate must not be null"); return count(predicate) > 0; } @@ -209,8 +209,8 @@ public class QuerydslKeyValuePredicateExecutor implements ListQuerydslPredica public R findBy(Predicate predicate, Function, R> queryFunction) { - Assert.notNull(predicate, "Predicate must not be null!"); - Assert.notNull(queryFunction, "Query function must not be null!"); + Assert.notNull(predicate, "Predicate must not be null"); + Assert.notNull(queryFunction, "Query function must not be null"); return queryFunction.apply(new FluentQuerydsl<>(predicate, (Class) entityInformation.getJavaType())); } @@ -260,7 +260,7 @@ public class QuerydslKeyValuePredicateExecutor implements ListQuerydslPredica @Override public FluentQuery.FetchableFluentQuery sortBy(Sort sort) { - Assert.notNull(sort, "Sort must not be null!"); + Assert.notNull(sort, "Sort must not be null"); return new FluentQuerydsl<>(predicate, sort, entityType, resultType, fieldsToInclude); } @@ -268,14 +268,14 @@ public class QuerydslKeyValuePredicateExecutor implements ListQuerydslPredica @Override public FluentQuery.FetchableFluentQuery as(Class projection) { - Assert.notNull(projection, "Projection target type must not be null!"); + Assert.notNull(projection, "Projection target type must not be null"); return new FluentQuerydsl<>(predicate, sort, entityType, projection, fieldsToInclude); } public FluentQuery.FetchableFluentQuery project(Collection properties) { - Assert.notNull(properties, "Projection properties must not be null!"); + Assert.notNull(properties, "Projection properties must not be null"); return new FluentQuerydsl<>(predicate, sort, entityType, resultType, new ArrayList<>(properties)); } @@ -322,7 +322,7 @@ public class QuerydslKeyValuePredicateExecutor implements ListQuerydslPredica @Override public Page page(Pageable pageable) { - Assert.notNull(pageable, "Pageable must not be null!"); + Assert.notNull(pageable, "Pageable must not be null"); AbstractCollQuery query = createQuery(); diff --git a/src/main/java/org/springframework/data/keyvalue/repository/support/QuerydslKeyValueRepository.java b/src/main/java/org/springframework/data/keyvalue/repository/support/QuerydslKeyValueRepository.java index 39bf6e6..25bf678 100644 --- a/src/main/java/org/springframework/data/keyvalue/repository/support/QuerydslKeyValueRepository.java +++ b/src/main/java/org/springframework/data/keyvalue/repository/support/QuerydslKeyValueRepository.java @@ -76,7 +76,7 @@ public class QuerydslKeyValueRepository extends SimpleKeyValueRepository< super(entityInformation, operations); - Assert.notNull(resolver, "EntityPathResolver must not be null!"); + Assert.notNull(resolver, "EntityPathResolver must not be null"); this.executor = new QuerydslKeyValuePredicateExecutor<>(entityInformation, new SpelAwareProxyProjectionFactory(), operations, resolver); diff --git a/src/main/java/org/springframework/data/keyvalue/repository/support/SimpleKeyValueRepository.java b/src/main/java/org/springframework/data/keyvalue/repository/support/SimpleKeyValueRepository.java index ddf6610..67b931b 100644 --- a/src/main/java/org/springframework/data/keyvalue/repository/support/SimpleKeyValueRepository.java +++ b/src/main/java/org/springframework/data/keyvalue/repository/support/SimpleKeyValueRepository.java @@ -53,8 +53,8 @@ public class SimpleKeyValueRepository implements KeyValueRepository metadata, KeyValueOperations operations) { - Assert.notNull(metadata, "EntityInformation must not be null!"); - Assert.notNull(operations, "KeyValueOperations must not be null!"); + Assert.notNull(metadata, "EntityInformation must not be null"); + Assert.notNull(operations, "KeyValueOperations must not be null"); this.entityInformation = metadata; this.operations = operations; @@ -67,7 +67,7 @@ public class SimpleKeyValueRepository implements KeyValueRepository S save(S entity) { - Assert.notNull(entity, "Entity must not be null!"); + Assert.notNull(entity, "Entity must not be null"); if (entityInformation.isNew(entity)) { return operations.insert(entity); @@ -79,7 +79,7 @@ public class SimpleKeyValueRepository implements KeyValueRepository List saveAll(Iterable entities) { - Assert.notNull(entities, "The given Iterable of entities must not be null!"); + Assert.notNull(entities, "The given Iterable of entities must not be null"); List saved = new ArrayList<>(); @@ -93,7 +93,7 @@ public class SimpleKeyValueRepository implements KeyValueRepository findById(ID id) { - Assert.notNull(id, "The given id must not be null!"); + Assert.notNull(id, "The given id must not be null"); return operations.findById(id, entityInformation.getJavaType()); } @@ -111,7 +111,7 @@ public class SimpleKeyValueRepository implements KeyValueRepository findAllById(Iterable ids) { - Assert.notNull(ids, "The given Iterable of id's must not be null!"); + Assert.notNull(ids, "The given Iterable of id's must not be null"); List result = new ArrayList<>(); @@ -128,7 +128,7 @@ public class SimpleKeyValueRepository implements KeyValueRepository implements KeyValueRepository implements KeyValueRepository ids) { - Assert.notNull(ids, "The given Iterable of Ids must not be null!"); + Assert.notNull(ids, "The given Iterable of Ids must not be null"); ids.forEach(this::deleteById); } @@ -152,7 +152,7 @@ public class SimpleKeyValueRepository implements KeyValueRepository entities) { - Assert.notNull(entities, "The given Iterable of entities must not be null!"); + Assert.notNull(entities, "The given Iterable of entities must not be null"); entities.forEach(this::delete); } @@ -169,7 +169,7 @@ public class SimpleKeyValueRepository implements KeyValueRepository findAll(Sort sort) { - Assert.notNull(sort, "Sort must not be null!"); + Assert.notNull(sort, "Sort must not be null"); return IterableConverter.toList(operations.findAll(sort, entityInformation.getJavaType())); } @@ -177,7 +177,7 @@ public class SimpleKeyValueRepository implements KeyValueRepository findAll(Pageable pageable) { - Assert.notNull(pageable, "Pageable must not be null!"); + Assert.notNull(pageable, "Pageable must not be null"); if (pageable.isUnpaged()) { List result = findAll(); diff --git a/src/main/java/org/springframework/data/map/MapKeyValueAdapter.java b/src/main/java/org/springframework/data/map/MapKeyValueAdapter.java index f3ed501..e308845 100644 --- a/src/main/java/org/springframework/data/map/MapKeyValueAdapter.java +++ b/src/main/java/org/springframework/data/map/MapKeyValueAdapter.java @@ -116,8 +116,8 @@ public class MapKeyValueAdapter extends AbstractKeyValueAdapter { super(engine); - Assert.notNull(store, "Store must not be null."); - Assert.notNull(keySpaceMapType, "Map type to be used for key spaces must not be null!"); + Assert.notNull(store, "Store must not be null"); + Assert.notNull(keySpaceMapType, "Map type to be used for key spaces must not be null"); this.store = store; this.keySpaceMapType = keySpaceMapType; @@ -126,8 +126,8 @@ public class MapKeyValueAdapter extends AbstractKeyValueAdapter { @Override public Object put(Object id, Object item, String keyspace) { - Assert.notNull(id, "Cannot add item with null id."); - Assert.notNull(keyspace, "Cannot add item for null collection."); + Assert.notNull(id, "Cannot add item with null id"); + Assert.notNull(keyspace, "Cannot add item for null collection"); return getKeySpaceMap(keyspace).put(id, item); } @@ -145,14 +145,14 @@ public class MapKeyValueAdapter extends AbstractKeyValueAdapter { @Override public Object get(Object id, String keyspace) { - Assert.notNull(id, "Cannot get item with null id."); + Assert.notNull(id, "Cannot get item with null id"); return getKeySpaceMap(keyspace).get(id); } @Override public Object delete(Object id, String keyspace) { - Assert.notNull(id, "Cannot delete item with null id."); + Assert.notNull(id, "Cannot delete item with null id"); return getKeySpaceMap(keyspace).remove(id); } @@ -189,7 +189,7 @@ public class MapKeyValueAdapter extends AbstractKeyValueAdapter { */ protected Map getKeySpaceMap(String keyspace) { - Assert.notNull(keyspace, "Collection must not be null for lookup!"); + Assert.notNull(keyspace, "Collection must not be null for lookup"); return store.computeIfAbsent(keyspace, k -> CollectionFactory.createMap(keySpaceMapType, 1000)); } diff --git a/src/test/java/org/springframework/data/map/repository/config/MapRepositoriesConfigurationExtensionIntegrationTests.java b/src/test/java/org/springframework/data/map/repository/config/MapRepositoriesConfigurationExtensionIntegrationTests.java index da4de44..19096d0 100644 --- a/src/test/java/org/springframework/data/map/repository/config/MapRepositoriesConfigurationExtensionIntegrationTests.java +++ b/src/test/java/org/springframework/data/map/repository/config/MapRepositoriesConfigurationExtensionIntegrationTests.java @@ -79,7 +79,7 @@ class MapRepositoriesConfigurationExtensionIntegrationTests { PersonRepository repository = context.getBean(PersonRepository.class); - assertThatThrownBy(() -> repository.findById("foo")).hasRootCauseInstanceOf(IllegalStateException.class).hasMessageContaining("Mock!"); + assertThatThrownBy(() -> repository.findById("foo")).hasRootCauseInstanceOf(IllegalStateException.class).hasMessageContaining("Mock"); context.close(); } @@ -128,7 +128,7 @@ class MapRepositoriesConfigurationExtensionIntegrationTests { KeyValueAdapter mock = mock(KeyValueAdapter.class); - when(mock.get(any(), anyString(), any())).thenThrow(new IllegalStateException("Mock!")); + when(mock.get(any(), anyString(), any())).thenThrow(new IllegalStateException("Mock")); return mock; }