Skip to content

Commit 0f67e9a

Browse files
committed
DATAES-329 - Remove references to Assert single-arg methods.
Replace references to Assert single-arg methods with references to methods accepting the test object and message. Related ticket: SPR-15196.
1 parent a5c99a1 commit 0f67e9a

File tree

6 files changed

+33
-14
lines changed

6 files changed

+33
-14
lines changed

src/main/java/org/springframework/data/elasticsearch/core/convert/MappingElasticsearchConverter.java

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2013 the original author or authors.
2+
* Copyright 2013-2017 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -31,8 +31,8 @@
3131
*
3232
* @author Rizwan Idrees
3333
* @author Mohsin Husen
34+
* @author Mark Paluch
3435
*/
35-
3636
public class MappingElasticsearchConverter implements ElasticsearchConverter, ApplicationContextAware {
3737

3838
private final MappingContext<? extends ElasticsearchPersistentEntity<?>, ElasticsearchPersistentProperty> mappingContext;
@@ -43,7 +43,9 @@ public class MappingElasticsearchConverter implements ElasticsearchConverter, Ap
4343

4444
public MappingElasticsearchConverter(
4545
MappingContext<? extends ElasticsearchPersistentEntity<?>, ElasticsearchPersistentProperty> mappingContext) {
46-
Assert.notNull(mappingContext);
46+
47+
Assert.notNull(mappingContext, "MappingContext must not be null!");
48+
4749
this.mappingContext = mappingContext;
4850
this.conversionService = new DefaultConversionService();
4951
}

src/main/java/org/springframework/data/elasticsearch/core/query/AbstractQuery.java

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2013-2016 the original author or authors.
2+
* Copyright 2013-2017 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -29,6 +29,7 @@
2929
*
3030
* @author Rizwan Idrees
3131
* @author Mohsin Husen
32+
* @author Mark Paluch
3233
*/
3334
abstract class AbstractQuery implements Query {
3435

@@ -55,7 +56,9 @@ public Pageable getPageable() {
5556

5657
@Override
5758
public final <T extends Query> T setPageable(Pageable pageable) {
58-
Assert.notNull(pageable);
59+
60+
Assert.notNull(pageable, "Pageable must not be null!");
61+
5962
this.pageable = pageable;
6063
return (T) this.addSort(pageable.getSort());
6164
}

src/main/java/org/springframework/data/elasticsearch/repository/support/AbstractElasticsearchRepository.java

+8-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2013-2016 the original author or authors.
2+
* Copyright 2013-2017 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -43,6 +43,7 @@
4343
* @author Mohsin Husen
4444
* @author Ryan Henszey
4545
* @author Kevin Leturc
46+
* @author Mark Paluch
4647
*/
4748
public abstract class AbstractElasticsearchRepository<T, ID extends Serializable> implements
4849
ElasticsearchRepository<T, ID> {
@@ -56,14 +57,18 @@ public AbstractElasticsearchRepository() {
5657
}
5758

5859
public AbstractElasticsearchRepository(ElasticsearchOperations elasticsearchOperations) {
59-
Assert.notNull(elasticsearchOperations);
60+
61+
Assert.notNull(elasticsearchOperations, "ElasticsearchOperations must not be null!");
62+
6063
this.setElasticsearchOperations(elasticsearchOperations);
6164
}
6265

6366
public AbstractElasticsearchRepository(ElasticsearchEntityInformation<T, ID> metadata,
6467
ElasticsearchOperations elasticsearchOperations) {
6568
this(elasticsearchOperations);
66-
Assert.notNull(metadata);
69+
70+
Assert.notNull(metadata, "ElasticsearchEntityInformation must not be null!");
71+
6772
this.entityInformation = metadata;
6873
setEntityClass(this.entityInformation.getJavaType());
6974
try {

src/main/java/org/springframework/data/elasticsearch/repository/support/ElasticsearchEntityInformationCreatorImpl.java

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2013-2014 the original author or authors.
2+
* Copyright 2013-2017 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -28,14 +28,17 @@
2828
* @author Rizwan Idrees
2929
* @author Mohsin Husen
3030
* @author Oliver Gierke
31+
* @author Mark Paluch
3132
*/
3233
public class ElasticsearchEntityInformationCreatorImpl implements ElasticsearchEntityInformationCreator {
3334

3435
private final MappingContext<? extends ElasticsearchPersistentEntity<?>, ElasticsearchPersistentProperty> mappingContext;
3536

3637
public ElasticsearchEntityInformationCreatorImpl(
3738
MappingContext<? extends ElasticsearchPersistentEntity<?>, ElasticsearchPersistentProperty> mappingContext) {
38-
Assert.notNull(mappingContext);
39+
40+
Assert.notNull(mappingContext, "MappingContext must not be null!");
41+
3942
this.mappingContext = mappingContext;
4043
}
4144

src/main/java/org/springframework/data/elasticsearch/repository/support/ElasticsearchRepositoryFactory.java

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2013 the original author or authors.
2+
* Copyright 2013-2017 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -43,14 +43,17 @@
4343
* @author Mohsin Husen
4444
* @author Ryan Henszey
4545
* @author Gad Akuka
46+
* @author Mark Paluch
4647
*/
4748
public class ElasticsearchRepositoryFactory extends RepositoryFactorySupport {
4849

4950
private final ElasticsearchOperations elasticsearchOperations;
5051
private final ElasticsearchEntityInformationCreator entityInformationCreator;
5152

5253
public ElasticsearchRepositoryFactory(ElasticsearchOperations elasticsearchOperations) {
53-
Assert.notNull(elasticsearchOperations);
54+
55+
Assert.notNull(elasticsearchOperations, "ElasticsearchOperations must not be null!");
56+
5457
this.elasticsearchOperations = elasticsearchOperations;
5558
this.entityInformationCreator = new ElasticsearchEntityInformationCreatorImpl(elasticsearchOperations
5659
.getElasticsearchConverter().getMappingContext());

src/main/java/org/springframework/data/elasticsearch/repository/support/ElasticsearchRepositoryFactoryBean.java

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2013 the original author or authors.
2+
* Copyright 2013-2017 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -29,6 +29,7 @@
2929
*
3030
* @author Rizwan Idrees
3131
* @author Mohsin Husen
32+
* @author Mark Paluch
3233
*/
3334
public class ElasticsearchRepositoryFactoryBean<T extends Repository<S, ID>, S, ID extends Serializable> extends
3435
RepositoryFactoryBeanSupport<T, S, ID> {
@@ -50,7 +51,9 @@ public ElasticsearchRepositoryFactoryBean(Class<? extends T> repositoryInterface
5051
* @param operations the operations to set
5152
*/
5253
public void setElasticsearchOperations(ElasticsearchOperations operations) {
53-
Assert.notNull(operations);
54+
55+
Assert.notNull(operations, "ElasticsearchOperations must not be null!");
56+
5457
setMappingContext(operations.getElasticsearchConverter().getMappingContext());
5558
this.operations = operations;
5659
}

0 commit comments

Comments
 (0)