Revisit Assert to avoid single-arg assert methods (with refined messages)

Issue: SPR-15196
This commit is contained in:
Juergen Hoeller
2017-01-30 22:15:53 +01:00
parent 768802fa96
commit 1b2dc3638f
118 changed files with 708 additions and 828 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-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.
@@ -61,7 +61,7 @@ public class MockAsyncContext implements AsyncContext {
public void addDispatchHandler(Runnable handler) {
Assert.notNull(handler);
Assert.notNull(handler, "Dispatch handler must not be null");
this.dispatchHandlers.add(handler);
}
@@ -77,7 +77,7 @@ public class MockAsyncContext implements AsyncContext {
@Override
public boolean hasOriginalRequestAndResponse() {
return (this.request instanceof MockHttpServletRequest) && (this.response instanceof MockHttpServletResponse);
return (this.request instanceof MockHttpServletRequest && this.response instanceof MockHttpServletResponse);
}
@Override

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-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.
@@ -356,12 +356,12 @@ public class MockPageContext extends PageContext {
}
public byte[] getContentAsByteArray() {
Assert.isTrue(this.response instanceof MockHttpServletResponse);
Assert.state(this.response instanceof MockHttpServletResponse, "MockHttpServletResponse required");
return ((MockHttpServletResponse) this.response).getContentAsByteArray();
}
public String getContentAsString() throws UnsupportedEncodingException {
Assert.isTrue(this.response instanceof MockHttpServletResponse);
Assert.state(this.response instanceof MockHttpServletResponse, "MockHttpServletResponse required");
return ((MockHttpServletResponse) this.response).getContentAsString();
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-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.
@@ -43,7 +43,7 @@ public class SimpleRequestExpectationManager extends AbstractRequestExpectationM
@Override
protected void afterExpectationsDeclared() {
Assert.state(this.expectationIterator == null);
Assert.state(this.expectationIterator == null, "Expectations already declared");
this.expectationIterator = getExpectations().iterator();
}