Revisit Assert to avoid single-arg assert methods (with refined messages)
Issue: SPR-15196
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user