Class AbstractMockHttpServletResponseAssert<SELF extends AbstractMockHttpServletResponseAssert<SELF,ACTUAL>,ACTUAL>  
java.lang.Object
org.assertj.core.api.AbstractAssert<SELF,ACTUAL>
 
org.assertj.core.api.AbstractObjectAssert<SELF,ACTUAL>
 
org.springframework.test.web.servlet.assertj.AbstractHttpServletResponseAssert<MockHttpServletResponse,SELF,ACTUAL>
  
org.springframework.test.web.servlet.assertj.AbstractMockHttpServletResponseAssert<SELF,ACTUAL> 
- Type Parameters:
- SELF- the type of assertions
- ACTUAL- the type of the object to assert
- All Implemented Interfaces:
- org.assertj.core.api.Assert<SELF,,- ACTUAL> - org.assertj.core.api.Descriptable<SELF>,- org.assertj.core.api.ExtensionPoints<SELF,- ACTUAL> 
- Direct Known Subclasses:
- MvcTestResultAssert
public abstract class AbstractMockHttpServletResponseAssert<SELF extends AbstractMockHttpServletResponseAssert<SELF,ACTUAL>,ACTUAL>  
extends AbstractHttpServletResponseAssert<MockHttpServletResponse,SELF,ACTUAL>  
Extension of 
AbstractHttpServletResponseAssert for
 MockHttpServletResponse.- Since:
- 6.2
- Author:
- Stephane Nicoll
- 
Field SummaryFields inherited from class org.assertj.core.api.AbstractAssertactual, info, myself, objects, throwUnsupportedExceptionOnEquals
- 
Constructor SummaryConstructorsModifierConstructorDescriptionprotectedAbstractMockHttpServletResponseAssert(HttpMessageContentConverter contentConverter, ACTUAL actual, Class<?> selfType) 
- 
Method SummaryModifier and TypeMethodDescriptionorg.assertj.core.api.AbstractByteArrayAssert<?>body()Return a new assertion object that uses the response body as the object to test.bodyJson()Return a new assertion object that uses the response body converted to text as the object to test.org.assertj.core.api.AbstractStringAssert<?>bodyText()Return a new assertion object that uses the response body converted to text as the object to test.Return a new assertion object that uses the forwarded URL as the object to test.hasBodyTextEqualTo(String bodyText) Verify that the response body is equal to the given value.hasErrorMessage(String errorMessage) Verify that theHttpServletResponse.sendError(int, String)Servlet error message} is equal to the given value.hasForwardedUrl(String forwardedUrl) Verify that the forwarded URL is equal to the given value.hasRedirectedUrl(String redirectedUrl) Verify that the redirected URL is equal to the given value.Return a new assertion object that uses the redirected URL as the object to test.Methods inherited from class org.springframework.test.web.servlet.assertj.AbstractHttpServletResponseAssertcontainsHeader, contentType, doesNotContainHeader, getResponse, hasContentType, hasContentType, hasContentTypeCompatibleWith, hasContentTypeCompatibleWith, hasHeader, hasStatus, hasStatus, hasStatus1xxInformational, hasStatus2xxSuccessful, hasStatus3xxRedirection, hasStatus4xxClientError, hasStatus5xxServerError, hasStatusOk, headersMethods inherited from class org.assertj.core.api.AbstractObjectAssertas, as, doesNotReturn, extracting, extracting, extracting, extracting, extracting, extracting, extractingForProxy, getComparatorsByType, hasAllNullFieldsOrProperties, hasAllNullFieldsOrPropertiesExcept, hasFieldOrProperty, hasFieldOrPropertyWithValue, hasNoNullFieldsOrProperties, hasNoNullFieldsOrPropertiesExcept, hasOnlyFields, isEqualToComparingFieldByField, isEqualToComparingFieldByFieldRecursively, isEqualToComparingOnlyGivenFields, isEqualToIgnoringGivenFields, isEqualToIgnoringNullFields, newObjectAssert, returns, usingComparatorForFields, usingComparatorForType, usingRecursiveAssertion, usingRecursiveAssertion, usingRecursiveComparison, usingRecursiveComparisonMethods inherited from class org.assertj.core.api.AbstractAssertareEqual, asInstanceOf, asList, assertionError, asString, describedAs, descriptionText, doesNotHave, doesNotHaveSameClassAs, doesNotHaveSameHashCodeAs, doesNotHaveToString, doesNotHaveToString, equals, extracting, extracting, failure, failureWithActualExpected, failWithActualExpectedAndMessage, failWithMessage, getWritableAssertionInfo, has, hashCode, hasSameClassAs, hasSameHashCodeAs, hasToString, hasToString, inBinary, inHexadecimal, is, isElementOfCustomAssert, isEqualTo, isExactlyInstanceOf, isIn, isIn, isInstanceOf, isInstanceOfAny, isInstanceOfSatisfying, isNot, isNotEqualTo, isNotExactlyInstanceOf, isNotIn, isNotIn, isNotInstanceOf, isNotInstanceOfAny, isNotNull, isNotOfAnyClassIn, isNotSameAs, isNull, isOfAnyClassIn, isSameAs, matches, matches, newListAssertInstance, overridingErrorMessage, overridingErrorMessage, satisfies, satisfies, satisfies, satisfiesAnyOf, satisfiesAnyOf, satisfiesAnyOfForProxy, satisfiesForProxy, setCustomRepresentation, setDescriptionConsumer, setPrintAssertionsDescription, throwAssertionError, usingComparator, usingComparator, usingDefaultComparator, withFailMessage, withFailMessage, withRepresentation, withThreadDumpOnErrorMethods inherited from class java.lang.Objectclone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.assertj.core.api.Descriptableas, describedAs, describedAs
- 
Constructor Details- 
AbstractMockHttpServletResponseAssertprotected AbstractMockHttpServletResponseAssert(@Nullable HttpMessageContentConverter contentConverter, ACTUAL actual, Class<?> selfType) 
 
- 
- 
Method Details- 
bodyTextpublic org.assertj.core.api.AbstractStringAssert<?> bodyText()Return a new assertion object that uses the response body converted to text as the object to test.Examples: // Check that the response body is equal to "Hello World": assertThat(response).bodyText().isEqualTo("Hello World");
- 
bodyJsonReturn a new assertion object that uses the response body converted to text as the object to test. Compared tobodyText(), the assertion object provides dedicated JSON support.Examples: 
 The returned assert object also supports JSON path expressions.// Check that the response body is strictly equal to the content of // "/com/acme/sample/person-created.json": assertThat(response).bodyJson() .isStrictlyEqualToJson("/com/acme/sample/person-created.json"); // Check that the response is strictly equal to the content of the // specified file located in the same package as the PersonController: assertThat(response).bodyJson().withResourceLoadClass(PersonController.class) .isStrictlyEqualToJson("person-created.json");Examples: // Check that the JSON document does not have an "error" element assertThat(response).bodyJson().doesNotHavePath("$.error"); // Check that the JSON document as a top level "message" element assertThat(response).bodyJson() .extractingPath("$.message").asString().isEqualTo("hello");
- 
bodypublic org.assertj.core.api.AbstractByteArrayAssert<?> body()Return a new assertion object that uses the response body as the object to test.- See Also:
 
- 
forwardedUrlReturn a new assertion object that uses the forwarded URL as the object to test. If a simple equality check is required, consider usinghasForwardedUrl(String)instead.Example: // Check that the forwarded URL starts with "/orders/": assertThat(response).forwardedUrl().matchPattern("/orders/*);
- 
redirectedUrlReturn a new assertion object that uses the redirected URL as the object to test. If a simple equality check is required, consider usinghasRedirectedUrl(String)instead.Example: // Check that the redirected URL starts with "/orders/": assertThat(response).redirectedUrl().matchPattern("/orders/*);
- 
hasBodyTextEqualToVerify that the response body is equal to the given value.
- 
hasForwardedUrlVerify that the forwarded URL is equal to the given value.- Parameters:
- forwardedUrl- the expected forwarded URL (can be null)
 
- 
hasRedirectedUrlVerify that the redirected URL is equal to the given value.- Parameters:
- redirectedUrl- the expected redirected URL (can be null)
 
- 
hasErrorMessageVerify that theHttpServletResponse.sendError(int, String)Servlet error message} is equal to the given value.- Parameters:
- errorMessage- the expected Servlet error message (can be null)
- Since:
- 6.2.1
 
 
-