Class AbstractHttpServletResponseAssert<R extends jakarta.servlet.http.HttpServletResponse, SELF extends AbstractHttpServletResponseAssert<R,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<R,SELF,ACTUAL>  
- Type Parameters:
- R- the type of- HttpServletResponse
- 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:
- AbstractMockHttpServletResponseAssert
public abstract class AbstractHttpServletResponseAssert<R extends jakarta.servlet.http.HttpServletResponse, SELF extends AbstractHttpServletResponseAssert<R,SELF,ACTUAL>, ACTUAL>  
extends org.assertj.core.api.AbstractObjectAssert<SELF,ACTUAL> 
Base AssertJ assertions that can be
applied to any object that provides an 
HttpServletResponse. This
provides direct access to response assertions while also providing access to
a different top-level object.- Since:
- 6.2
- Author:
- Stephane Nicoll
- 
Field SummaryFields inherited from class org.assertj.core.api.AbstractAssertactual, info, myself, objects, throwUnsupportedExceptionOnEquals
- 
Constructor SummaryConstructorsModifierConstructorDescriptionprotectedAbstractHttpServletResponseAssert(ACTUAL actual, Class<?> selfType) 
- 
Method SummaryModifier and TypeMethodDescriptioncontainsHeader(String name) Verify that the response contains a header with the givenname.Return a new assertion object that uses the response's content type as the object to test.doesNotContainHeader(String name) Verify that the response does not contain a header with the givenname.protected abstract RProvide the response to use if it is available.hasContentType(String contentType) Verify that the response'sContent-Typeis equal to the given string representation.hasContentType(MediaType contentType) Verify that the response'sContent-Typeis equal to the given value.hasContentTypeCompatibleWith(String contentType) Verify that the response'sContent-Typeis compatible with the given string representation.hasContentTypeCompatibleWith(MediaType contentType) Verify that the response'sContent-Typeis compatible with the given value.Verify that the response contains a header with the givennameand primaryvalue.hasStatus(int status) Verify that the HTTP status is equal to the specified status code.hasStatus(HttpStatus status) Verify that the HTTP status is equal to the specified status.Verify that the HTTP status code is in the 1xx range.Verify that the HTTP status code is in the 2xx range.Verify that the HTTP status code is in the 3xx range.Verify that the HTTP status code is in the 4xx range.Verify that the HTTP status code is in the 5xx range.Verify that the HTTP status is equal toHttpStatus.OK.headers()Return a new assertion object that usesHttpHeadersas the object to test.Methods 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.AbstractAssertactual, areEqual, asInstanceOf, asList, assertionError, asString, describedAs, descriptionText, doesNotHave, doesNotHaveSameClassAs, doesNotHaveSameHashCodeAs, doesNotHaveToString, doesNotHaveToString, doesNotMatch, doesNotMatch, 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, usingEquals, usingEquals, withFailMessage, withFailMessage, withRepresentation, withThreadDumpOnErrorMethods inherited from class Objectclone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.assertj.core.api.Descriptableas, describedAs, describedAs
- 
Constructor Details- 
AbstractHttpServletResponseAssert
 
- 
- 
Method Details- 
getResponseProvide the response to use if it is available.Throws an AssertionErrorif the request has failed to process, and the response is not available.- Returns:
- the response to use
 
- 
contentTypeReturn a new assertion object that uses the response's content type as the object to test.
- 
headersReturn a new assertion object that usesHttpHeadersas the object to test. The returned assertion object provides all the regular map assertions, with headers mapped by header name. Examples:// Check for the presence of the Accept header: assertThat(response).headers().containsHeader(HttpHeaders.ACCEPT); // Check for the absence of the Content-Length header: assertThat(response).headers().doesNotContainsHeader(HttpHeaders.CONTENT_LENGTH);
- 
hasContentType
- 
hasContentType
- 
hasContentTypeCompatibleWithVerify that the response'sContent-Typeis compatible with the given value.- Parameters:
- contentType- the expected compatible content type
 
- 
hasContentTypeCompatibleWithVerify that the response'sContent-Typeis compatible with the given string representation.- Parameters:
- contentType- the expected compatible content type
 
- 
containsHeader
- 
doesNotContainHeader
- 
hasHeader
- 
hasStatusVerify that the HTTP status is equal to the specified status code.- Parameters:
- status- the expected HTTP status code
 
- 
hasStatusVerify that the HTTP status is equal to the specified status.- Parameters:
- status- the expected HTTP status code
 
- 
hasStatusOk
- 
hasStatus1xxInformationalVerify that the HTTP status code is in the 1xx range.- See Also:
 
- 
hasStatus2xxSuccessfulVerify that the HTTP status code is in the 2xx range.- See Also:
 
- 
hasStatus3xxRedirectionVerify that the HTTP status code is in the 3xx range.- See Also:
 
- 
hasStatus4xxClientErrorVerify that the HTTP status code is in the 4xx range.- See Also:
 
- 
hasStatus5xxServerErrorVerify that the HTTP status code is in the 5xx range.- See Also:
 
 
-