Class HttpResponseAssertionBuilder
- java.lang.Object
-
- com.atlassian.bamboo.testutils.http.HttpResponseAssertionBuilder
-
public class HttpResponseAssertionBuilder extends Object
A utility class to build and perform assertions on HTTP response headers and status codes This class is used in test cases to assert that responses have the expected headers and status
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classHttpResponseAssertionBuilder.DispositionTypeEnum representing the type of content disposition
-
Constructor Summary
Constructors Constructor Description HttpResponseAssertionBuilder(org.springframework.mock.web.MockHttpServletResponse response)Constructs a HeaderAssertionBuilder for the specified response
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description HttpResponseAssertionBuildercontentDisposition(HttpResponseAssertionBuilder.DispositionType dispositionType, String filename)Specifies the expected content disposition headerHttpResponseAssertionBuilderheaderEquals(String header, String value)Specifies a header and its expected value in the responseHttpResponseAssertionBuilderisCompressed(boolean expectedCompressed, long expectedDecompressedLength)Specifies whether the response content is expected to be compressedHttpResponseAssertionBuildernullHeaders(String... headers)Specifies the headers that are expected to be absent (null) in the responseHttpResponseAssertionBuilderstatusIs(int status)Specifies the expected HTTP status code for the responsevoidverify()Executes the assertions based on the specified expectations Verifies that the response has the expected status code, null headers, and header values
-
-
-
Method Detail
-
statusIs
public HttpResponseAssertionBuilder statusIs(int status)
Specifies the expected HTTP status code for the response- Parameters:
status- the expected status code- Returns:
- the current instance of HeaderAssertionBuilder
-
nullHeaders
public HttpResponseAssertionBuilder nullHeaders(String... headers)
Specifies the headers that are expected to be absent (null) in the response- Parameters:
headers- the names of the headers expected to be null- Returns:
- the current instance of HeaderAssertionBuilder
-
headerEquals
public HttpResponseAssertionBuilder headerEquals(String header, String value)
Specifies a header and its expected value in the response- Parameters:
header- the name of the headervalue- the expected value of the header- Returns:
- the current instance of HeaderAssertionBuilder
-
isCompressed
public HttpResponseAssertionBuilder isCompressed(boolean expectedCompressed, long expectedDecompressedLength)
Specifies whether the response content is expected to be compressed- Parameters:
expectedCompressed- true if the content is expected to be compressed, false otherwiseexpectedDecompressedLength- the expected length of the decompressed content- Returns:
- the current instance of HeaderAssertionBuilder
-
contentDisposition
public HttpResponseAssertionBuilder contentDisposition(HttpResponseAssertionBuilder.DispositionType dispositionType, String filename)
Specifies the expected content disposition header- Parameters:
dispositionType- the expected disposition type (ATTACHMENT or INLINE)filename- the expected filename in the content disposition- Returns:
- the current instance of HeaderAssertionBuilder
-
verify
public void verify()
Executes the assertions based on the specified expectations Verifies that the response has the expected status code, null headers, and header values
-
-