Package org.springframework.test.http
Class MediaTypeAssert
java.lang.Object
org.assertj.core.api.AbstractAssert<SELF,ACTUAL>
org.assertj.core.api.AbstractObjectAssert<MediaTypeAssert,MediaType>
org.springframework.test.http.MediaTypeAssert
- All Implemented Interfaces:
org.assertj.core.api.Assert<MediaTypeAssert,
,MediaType> org.assertj.core.api.Descriptable<MediaTypeAssert>
,org.assertj.core.api.ExtensionPoints<MediaTypeAssert,
MediaType>
public class MediaTypeAssert
extends org.assertj.core.api.AbstractObjectAssert<MediaTypeAssert,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
-
Method Summary
Modifier and TypeMethodDescriptionisCompatibleWith
(String mediaType) Verify that the actual media type is compatible with the given one.isCompatibleWith
(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, 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
-
MediaTypeAssert
-
MediaTypeAssert
-
-
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
-