Package org.junit.jupiter.api.extension
Class MediaType
java.lang.Object
org.junit.jupiter.api.extension.MediaType
Represents a media type as defined by
RFC 2045.
- Since:
- 5.12
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final MediaTypeTheapplication/jsonmedia type.static final MediaTypeTheapplication/json; charset=UTF-8media type.static final MediaTypeTheapplication/octet-streammedia type.static final MediaTypeTheimage/jpegmedia type.static final MediaTypeTheimage/pngmedia type.static final MediaTypeThetext/plainmedia type.static final MediaTypeThetext/plain; charset=UTF-8media type. -
Method Summary
Modifier and TypeMethodDescriptionstatic MediaTypeCreate a media type with the given type and subtype.static MediaTypeCreate a media type with the given type, subtype, and charset.booleaninthashCode()static MediaTypeParse the given media type value.toString()Returns string representation of this media type.
-
Field Details
-
TEXT_PLAIN
Thetext/plainmedia type. -
TEXT_PLAIN_UTF_8
Thetext/plain; charset=UTF-8media type. -
APPLICATION_JSON
Theapplication/jsonmedia type. -
APPLICATION_JSON_UTF_8
Theapplication/json; charset=UTF-8media type. -
APPLICATION_OCTET_STREAM
Theapplication/octet-streammedia type. -
IMAGE_JPEG
Theimage/jpegmedia type. -
IMAGE_PNG
Theimage/pngmedia type.
-
-
Method Details
-
parse
Parse the given media type value.Must be valid according to RFC 2045.
- Parameters:
value- the media type value to parse; nevernull- Returns:
- the parsed media type
- Throws:
org.junit.platform.commons.PreconditionViolationException- if the value is not a valid media type
-
create
Create a media type with the given type and subtype.- Parameters:
type- the type; nevernullsubtype- the subtype; nevernull- Returns:
- the media type
-
create
Create a media type with the given type, subtype, and charset.- Parameters:
type- the type; nevernullsubtype- the subtype; nevernullcharset- the charset; nevernull- Returns:
- the media type
-
toString
Returns string representation of this media type. -
equals
-
hashCode
public int hashCode()
-