Package org.springframework.test.http
Class MediaTypeAssert
java.lang.Object
org.assertj.core.api.AbstractAssert<SELF,ACTUAL>
org.assertj.core.api.AbstractObjectAssert<MediaTypeAssert,org.springframework.http.MediaType>
org.springframework.test.http.MediaTypeAssert
- All Implemented Interfaces:
org.assertj.core.api.Assert<MediaTypeAssert,,org.springframework.http.MediaType> org.assertj.core.api.Descriptable<MediaTypeAssert>,org.assertj.core.api.ExtensionPoints<MediaTypeAssert,org.springframework.http.MediaType>
public class MediaTypeAssert
extends org.assertj.core.api.AbstractObjectAssert<MediaTypeAssert,org.springframework.http.MediaType>
AssertJ
assertions that can be applied
to a MediaType.- Since:
- 6.2
- Author:
- Brian Clozel, Stephane Nicoll
-
Field Summary
Fields inherited from class org.assertj.core.api.AbstractAssert
actual, info, myself, objects, throwUnsupportedExceptionOnEquals -
Constructor Summary
ConstructorsConstructorDescriptionMediaTypeAssert(String actual) MediaTypeAssert(org.springframework.http.MediaType mediaType) -
Method Summary
Modifier and TypeMethodDescriptionisCompatibleWith(String mediaType) Verify that the actual media type is compatible with the given one.isCompatibleWith(org.springframework.http.MediaType mediaType) Verify that the actual media type is compatible with the given one.Verify that the actual media type is equal to the given string representation.isNotEqualTo(String mediaType) Verify that the actual media type is not equal to the given string representation.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, usingRecursiveComparisonMethods inherited from class org.assertj.core.api.AbstractAssert
actual, 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 java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.assertj.core.api.Descriptable
as, describedAs, describedAs
-
Constructor Details
-
MediaTypeAssert
-
MediaTypeAssert
public MediaTypeAssert(@Nullable org.springframework.http.MediaType mediaType)
-
-
Method Details
-
isEqualTo
Verify that the actual media type is equal to the given string representation.- Parameters:
mediaType- the expected media type, as a String to be parsed into a MediaType
-
isNotEqualTo
Verify that the actual media type is not equal to the given string representation.- Parameters:
mediaType- the given media type, as a String to be parsed into a MediaType
-
isCompatibleWith
Verify that the actual media type is compatible with the given one.Example:
// Check that actual is compatible with "application/json" assertThat(mediaType).isCompatibleWith(MediaType.APPLICATION_JSON);- Parameters:
mediaType- the media type with which to compare
-
isCompatibleWith
Verify that the actual media type is compatible with the given one.Example:
// Check that actual is compatible with "text/plain" assertThat(mediaType).isCompatibleWith("text/plain");- Parameters:
mediaType- the media type with which to compare, as a String to be parsed into a MediaType
-