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.
This commit is contained in:
Mark Paluch
2017-02-01 09:37:25 +01:00
parent a612f4a2ac
commit b06f8664f1
6 changed files with 22 additions and 16 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2015 the original author or authors.
* Copyright 2015-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -32,6 +32,7 @@ import org.springframework.util.ClassUtils;
* {@link ResourceMappings} for {@link PersistentEntities}.
*
* @author Oliver Gierke
* @author Mark Paluch
*/
public class PersistentEntitiesResourceMappings implements ResourceMappings {
@@ -133,7 +134,7 @@ public class PersistentEntitiesResourceMappings implements ResourceMappings {
@Override
public boolean exportsTopLevelResourceFor(String path) {
Assert.hasText(path);
Assert.hasText(path, "Path must not be null or empty!");
for (ResourceMetadata metadata : this) {
if (metadata.getPath().matches(path)) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2016 the original author or authors.
* Copyright 2012-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -27,6 +27,7 @@ import org.springframework.util.Assert;
*
* @author Oliver Gierke
* @author David Turanski
* @author Mark Paluch
*/
@Region
public class Customer extends AbstractPersistentEntity {
@@ -44,9 +45,9 @@ public class Customer extends AbstractPersistentEntity {
*/
public Customer(Long id, EmailAddress emailAddress, String firstname, String lastname) {
super(id);
Assert.hasText(firstname);
Assert.hasText(lastname);
Assert.notNull(emailAddress);
Assert.hasText(firstname, "Firstname must not be null or empty!");
Assert.hasText(lastname, "Lastname must not be null or empty!");
Assert.notNull(emailAddress, "EmailAddress must not be null!");
this.firstname = firstname;
this.lastname = lastname;
@@ -62,7 +63,7 @@ public class Customer extends AbstractPersistentEntity {
*/
public void add(Address address) {
Assert.notNull(address);
Assert.notNull(address, "Address must not be null!");
this.addresses.add(address);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2016 the original author or authors.
* Copyright 2012-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -26,6 +26,7 @@ import org.springframework.util.Assert;
/**
* @author Oliver Gierke
* @author David Turanski
* @author Mark Paluch
*/
@Region
public class Order extends AbstractPersistentEntity {
@@ -44,8 +45,8 @@ public class Order extends AbstractPersistentEntity {
*/
public Order(Long id, Long customerId, Address shippingAddress) {
super(id);
Assert.notNull(customerId);
Assert.notNull(shippingAddress);
Assert.notNull(customerId, "CustomerId must not be null!");
Assert.notNull(shippingAddress, "ShippingAddress must not be null!");
this.customerId = customerId;
this.shippingAddress = shippingAddress;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2016 the original author or authors.
* Copyright 2012-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -29,6 +29,7 @@ import org.springframework.util.Assert;
*
* @author Oliver Gierke
* @author David Turanski
* @author Mark Paluch
*/
@Region
public class Product extends AbstractPersistentEntity {
@@ -77,7 +78,7 @@ public class Product extends AbstractPersistentEntity {
*/
public void setAttribute(String name, String value) {
Assert.hasText(name);
Assert.hasText(name, "Name must not be null or empty!");
if (value == null) {
this.attributes.remove(value);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2016 the original author or authors.
* Copyright 2016-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -37,6 +37,7 @@ import org.springframework.util.ReflectionUtils;
* {@link ResourceSupport}.
*
* @author Oliver Gierke
* @author Mark Paluch
* @since 2.5
* @deprecated use the same type from Spring HATEOAS, will be removed in 2.7.
*/
@@ -200,7 +201,7 @@ public class ResourceProcessorInvoker {
*/
public DefaultProcessorWrapper(ResourceProcessor<?> processor) {
Assert.notNull(processor);
Assert.notNull(processor, "ResourceProcessor must not be null!");
this.processor = processor;
this.targetType = ResolvableType.forClass(ResourceProcessor.class, processor.getClass()).getGeneric(0);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2016 the original author or authors.
* Copyright 2012-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -38,6 +38,7 @@ import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandl
*
* @author Oliver Gierke
* @author Phil Webb
* @author Mark Paluch
* @deprecated use the same type from Spring HATEOAS, will be removed in 2.7.
*/
@Deprecated
@@ -56,7 +57,7 @@ public class ResourceProcessorInvokingHandlerAdapter extends RequestMappingHandl
@Autowired(required = false)
public ResourceProcessorInvokingHandlerAdapter(ResourceProcessorInvoker invoker) {
Assert.notNull(invoker);
Assert.notNull(invoker, "ResourceProcessorInvoker must not be null!");
this.invoker = invoker;
}