Package com.github.ngeor.yak4j
Class ResponseEntityAssert<T>
- java.lang.Object
-
- org.assertj.core.api.AbstractAssert<ResponseEntityAssert<T>,ResponseEntity<T>>
-
- com.github.ngeor.yak4j.ResponseEntityAssert<T>
-
- Type Parameters:
T- The body of the response.
- All Implemented Interfaces:
Assert<ResponseEntityAssert<T>,ResponseEntity<T>>,Descriptable<ResponseEntityAssert<T>>,ExtensionPoints<ResponseEntityAssert<T>,ResponseEntity<T>>
public class ResponseEntityAssert<T> extends AbstractAssert<ResponseEntityAssert<T>,ResponseEntity<T>>
Assertion DSL forResponseEntity.
-
-
Field Summary
-
Fields inherited from class org.assertj.core.api.AbstractAssert
actual, info, myself, objects, throwUnsupportedExceptionOnEquals
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ResponseEntityAssert<T>hasBody(Consumer<T> requirements)Verifies that the response entity contains a body that satisfies the given requirements.ResponseEntityAssert<T>hasBody(T body)Verifies that the response contains the given object as body.ResponseEntityAssert<T>hasNotNullBody()Verifies that the body of the response entity is not null.ResponseEntityAssert<T>hasStatus(HttpStatus httpStatus)Verifies that the response has the given HTTP status code.ResponseEntityAssert<T>isBadRequest()ResponseEntityAssert<T>isConflict()ResponseEntityAssert<T>isCreated()ResponseEntityAssert<T>isForbidden()ResponseEntityAssert<T>isInternalServerError()ResponseEntityAssert<T>isNotFound()ResponseEntityAssert<T>isOk()ResponseEntityAssert<T>isUnauthorized()-
Methods inherited from class org.assertj.core.api.AbstractAssert
asInstanceOf, asList, assertionError, asString, describedAs, descriptionText, doesNotHave, doesNotHaveSameClassAs, doesNotHaveSameHashCodeAs, doesNotHaveToString, equals, extracting, extracting, failure, failureWithActualExpected, failWithActualExpectedAndMessage, failWithMessage, getWritableAssertionInfo, has, hashCode, hasSameClassAs, hasSameHashCodeAs, 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, satisfiesAnyOf, satisfiesAnyOf, satisfiesAnyOf, setCustomRepresentation, setDescriptionConsumer, setPrintAssertionsDescription, throwAssertionError, usingComparator, usingComparator, usingDefaultComparator, usingRecursiveComparison, usingRecursiveComparison, 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, as, as, describedAs
-
-
-
-
Method Detail
-
hasBody
public ResponseEntityAssert<T> hasBody(T body)
Verifies that the response contains the given object as body.- Parameters:
body- The expected body.- Returns:
- This instance.
-
hasBody
public ResponseEntityAssert<T> hasBody(Consumer<T> requirements)
Verifies that the response entity contains a body that satisfies the given requirements.Example:
assertThat(responseEntity).hasBody( body -> assertThat(body).isEqualTo("hello, world!") );- Parameters:
requirements- The requirements that the body must meet.- Returns:
- This instance.
-
hasNotNullBody
public ResponseEntityAssert<T> hasNotNullBody()
Verifies that the body of the response entity is not null.- Returns:
- This instance.
-
hasStatus
public ResponseEntityAssert<T> hasStatus(HttpStatus httpStatus)
Verifies that the response has the given HTTP status code.- Parameters:
httpStatus- The expected HTTP status code.- Returns:
- This instance.
-
isBadRequest
public ResponseEntityAssert<T> isBadRequest()
-
isConflict
public ResponseEntityAssert<T> isConflict()
-
isCreated
public ResponseEntityAssert<T> isCreated()
-
isForbidden
public ResponseEntityAssert<T> isForbidden()
-
isInternalServerError
public ResponseEntityAssert<T> isInternalServerError()
-
isNotFound
public ResponseEntityAssert<T> isNotFound()
-
isOk
public ResponseEntityAssert<T> isOk()
-
isUnauthorized
public ResponseEntityAssert<T> isUnauthorized()
-
-