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:
MvcResultAssert

public abstract class AbstractMockHttpServletResponseAssert<SELF extends AbstractMockHttpServletResponseAssert<SELF,ACTUAL>,ACTUAL> extends AbstractHttpServletResponseAssert<MockHttpServletResponse,SELF,ACTUAL>
Since:
6.2
Author:
Stephane Nicoll
  • Field Summary

    Fields inherited from class org.assertj.core.api.AbstractAssert

    actual, info, myself, objects, throwUnsupportedExceptionOnEquals
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
     
  • Method Summary

    Modifier and Type
    Method
    Description
    Return a new assertion object that uses the response body as the object to test.
    Return a new assertion object that uses the forwarded URL as the object to test.
    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.assertj.core.api.AbstractObjectAssert

    as, 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, usingRecursiveComparison

    Methods inherited from class org.assertj.core.api.AbstractAssert

    areEqual, 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, withThreadDumpOnError

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.assertj.core.api.Descriptable

    as, describedAs, describedAs
  • Constructor Details

  • Method Details

    • body

      public ResponseBodyAssert body()
      Return a new assertion object that uses the response body as the object to test. The returned assertion object provides access to the raw byte array, a String value decoded using the response's character encoding, and dedicated JSON testing support.

      Examples:

      
       // Check that the response body is equal to "Hello World":
       assertThat(response).body().isEqualTo("Hello World");
      
       // Check that the response body is strictly equal to the content of "test.json":
       assertThat(response).body().json().isStrictlyEqualToJson("test.json");
       
    • forwardedUrl

      public UriAssert forwardedUrl()
      Return a new assertion object that uses the forwarded URL as the object to test. If a simple equality check is required, consider using hasForwardedUrl(String) instead.

      Example:

      
       // Check that the forwarded URL starts with "/orders/":
       assertThat(response).forwardedUrl().matchPattern("/orders/*);
       
    • redirectedUrl

      public UriAssert redirectedUrl()
      Return a new assertion object that uses the redirected URL as the object to test. If a simple equality check is required, consider using hasRedirectedUrl(String) instead.

      Example:

      
       // Check that the redirected URL starts with "/orders/":
       assertThat(response).redirectedUrl().matchPattern("/orders/*);
       
    • hasForwardedUrl

      public SELF hasForwardedUrl(@Nullable String forwardedUrl)
      Verify that the forwarded URL is equal to the given value.
      Parameters:
      forwardedUrl - the expected forwarded URL (can be null)
    • hasRedirectedUrl

      public SELF hasRedirectedUrl(@Nullable String redirectedUrl)
      Verify that the redirected URL is equal to the given value.
      Parameters:
      redirectedUrl - the expected redirected URL (can be null)