Skip to content

Commit b06f866

Browse files
committed
DATAREST-992 - 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 a612f4a commit b06f866

File tree

6 files changed

+22
-16
lines changed

6 files changed

+22
-16
lines changed

spring-data-rest-core/src/main/java/org/springframework/data/rest/core/mapping/PersistentEntitiesResourceMappings.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2015 the original author or authors.
2+
* Copyright 2015-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.
@@ -32,6 +32,7 @@
3232
* {@link ResourceMappings} for {@link PersistentEntities}.
3333
*
3434
* @author Oliver Gierke
35+
* @author Mark Paluch
3536
*/
3637
public class PersistentEntitiesResourceMappings implements ResourceMappings {
3738

@@ -133,7 +134,7 @@ public boolean exportsMappingFor(Class<?> type) {
133134
@Override
134135
public boolean exportsTopLevelResourceFor(String path) {
135136

136-
Assert.hasText(path);
137+
Assert.hasText(path, "Path must not be null or empty!");
137138

138139
for (ResourceMetadata metadata : this) {
139140
if (metadata.getPath().matches(path)) {

spring-data-rest-tests/spring-data-rest-tests-gemfire/src/main/java/org/springframework/data/rest/tests/gemfire/Customer.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2016 the original author or authors.
2+
* Copyright 2012-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.
@@ -27,6 +27,7 @@
2727
*
2828
* @author Oliver Gierke
2929
* @author David Turanski
30+
* @author Mark Paluch
3031
*/
3132
@Region
3233
public class Customer extends AbstractPersistentEntity {
@@ -44,9 +45,9 @@ public class Customer extends AbstractPersistentEntity {
4445
*/
4546
public Customer(Long id, EmailAddress emailAddress, String firstname, String lastname) {
4647
super(id);
47-
Assert.hasText(firstname);
48-
Assert.hasText(lastname);
49-
Assert.notNull(emailAddress);
48+
Assert.hasText(firstname, "Firstname must not be null or empty!");
49+
Assert.hasText(lastname, "Lastname must not be null or empty!");
50+
Assert.notNull(emailAddress, "EmailAddress must not be null!");
5051

5152
this.firstname = firstname;
5253
this.lastname = lastname;
@@ -62,7 +63,7 @@ protected Customer() {}
6263
*/
6364
public void add(Address address) {
6465

65-
Assert.notNull(address);
66+
Assert.notNull(address, "Address must not be null!");
6667
this.addresses.add(address);
6768
}
6869

spring-data-rest-tests/spring-data-rest-tests-gemfire/src/main/java/org/springframework/data/rest/tests/gemfire/Order.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2016 the original author or authors.
2+
* Copyright 2012-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.
@@ -26,6 +26,7 @@
2626
/**
2727
* @author Oliver Gierke
2828
* @author David Turanski
29+
* @author Mark Paluch
2930
*/
3031
@Region
3132
public class Order extends AbstractPersistentEntity {
@@ -44,8 +45,8 @@ public class Order extends AbstractPersistentEntity {
4445
*/
4546
public Order(Long id, Long customerId, Address shippingAddress) {
4647
super(id);
47-
Assert.notNull(customerId);
48-
Assert.notNull(shippingAddress);
48+
Assert.notNull(customerId, "CustomerId must not be null!");
49+
Assert.notNull(shippingAddress, "ShippingAddress must not be null!");
4950

5051
this.customerId = customerId;
5152
this.shippingAddress = shippingAddress;

spring-data-rest-tests/spring-data-rest-tests-gemfire/src/main/java/org/springframework/data/rest/tests/gemfire/Product.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2016 the original author or authors.
2+
* Copyright 2012-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 Oliver Gierke
3131
* @author David Turanski
32+
* @author Mark Paluch
3233
*/
3334
@Region
3435
public class Product extends AbstractPersistentEntity {
@@ -77,7 +78,7 @@ protected Product() {}
7778
*/
7879
public void setAttribute(String name, String value) {
7980

80-
Assert.hasText(name);
81+
Assert.hasText(name, "Name must not be null or empty!");
8182

8283
if (value == null) {
8384
this.attributes.remove(value);

spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/ResourceProcessorInvoker.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2016 the original author or authors.
2+
* Copyright 2016-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.
@@ -37,6 +37,7 @@
3737
* {@link ResourceSupport}.
3838
*
3939
* @author Oliver Gierke
40+
* @author Mark Paluch
4041
* @since 2.5
4142
* @deprecated use the same type from Spring HATEOAS, will be removed in 2.7.
4243
*/
@@ -200,7 +201,7 @@ private static class DefaultProcessorWrapper implements ResourceProcessorInvoker
200201
*/
201202
public DefaultProcessorWrapper(ResourceProcessor<?> processor) {
202203

203-
Assert.notNull(processor);
204+
Assert.notNull(processor, "ResourceProcessor must not be null!");
204205

205206
this.processor = processor;
206207
this.targetType = ResolvableType.forClass(ResourceProcessor.class, processor.getClass()).getGeneric(0);

spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/ResourceProcessorInvokingHandlerAdapter.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2016 the original author or authors.
2+
* Copyright 2012-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.
@@ -38,6 +38,7 @@
3838
*
3939
* @author Oliver Gierke
4040
* @author Phil Webb
41+
* @author Mark Paluch
4142
* @deprecated use the same type from Spring HATEOAS, will be removed in 2.7.
4243
*/
4344
@Deprecated
@@ -56,7 +57,7 @@ public class ResourceProcessorInvokingHandlerAdapter extends RequestMappingHandl
5657
@Autowired(required = false)
5758
public ResourceProcessorInvokingHandlerAdapter(ResourceProcessorInvoker invoker) {
5859

59-
Assert.notNull(invoker);
60+
Assert.notNull(invoker, "ResourceProcessorInvoker must not be null!");
6061
this.invoker = invoker;
6162
}
6263

0 commit comments

Comments
 (0)