public class FluentPartAssert<P> extends HasParent<P>
Constructor and Description |
---|
FluentPartAssert(List<PartWithContext> actual,
P parent,
AssertionRegistry registry) |
FluentPartAssert(PartWithContext actual,
P parent,
AssertionRegistry registry) |
Modifier and Type | Method and Description |
---|---|
FluentPartAssert<P> |
content(org.hamcrest.Matcher<byte[]> matcher)
Make assertions on the raw content of a part (body, alternative or
attachment) of the message(s).
|
FluentPartAssert<P> |
contentAsString(org.hamcrest.Matcher<? super String> matcher)
Make assertions on the string content of a part (body, alternative or
attachment) of the message(s).
|
FluentPartAssert<P> |
contentAsString(org.hamcrest.Matcher<? super String> matcher,
Charset charset)
Make assertions on the string content of a part (body, alternative or
attachment) of the message(s).
|
FluentPartAssert<P> |
contentType(org.hamcrest.Matcher<? super String> matcher)
Make assertions on the content-type of a part (body, alternative or
attachment) of the message(s).
|
FluentPartAssert<P> |
description(org.hamcrest.Matcher<? super String> matcher)
Make assertions on the description of a part (body, alternative or
attachment) of the message(s).
|
FluentPartAssert<P> |
disposition(org.hamcrest.Matcher<? super String> matcher)
Make assertions on the disposition of a part (body, alternative or
attachment) of the message(s).
|
FluentPartAssert<P> |
filename(org.hamcrest.Matcher<? super String> matcher)
Make assertions on the filename of a part (body, alternative or
attachment) of the message(s).
|
FluentPartAssert<P> |
header(String headerName,
org.hamcrest.Matcher<? super Iterable<String>> matcher)
Make assertions on a single header of a part (body, alternative or
attachment) of the message(s).
|
FluentPartAssert<P> |
headers(org.hamcrest.Matcher<? super Iterable<javax.mail.Header>> matcher)
Make assertions on the headers of a part (body, alternative or
attachment) of the message(s).
|
public FluentPartAssert(PartWithContext actual, P parent, AssertionRegistry registry)
public FluentPartAssert(List<PartWithContext> actual, P parent, AssertionRegistry registry)
public FluentPartAssert<P> contentAsString(org.hamcrest.Matcher<? super String> matcher)
.receivedMessages().message(0).body() .contentAsString(is("foobar"))Will check if the content of the body of the first message is exactly "foobar".
.receivedMessages().every().body() .contentAsString(is("foobar"))Will check if the content of the body of every message is exactly "foobar".
matcher
- the assertion to apply on string contentpublic FluentPartAssert<P> contentAsString(org.hamcrest.Matcher<? super String> matcher, Charset charset)
.receivedMessages().message(0).body() .contentAsString(is("foobar"), Charset.forName("UTF-8"))Will check if the content of the body of the first message is exactly "foobar".
.receivedMessages().every().body() .contentAsString(is("foobar"), Charset.forName("UTF-8"))Will check if the content of the body of every message is exactly "foobar".
matcher
- the assertion to apply on string contentcharset
- the charset used to decode the contentpublic FluentPartAssert<P> content(org.hamcrest.Matcher<byte[]> matcher)
.receivedMessages().message(0).body() .content(is(resource("path/to/expected/file"))Will check if the content of the body of the first message is exactly the same as the file resource available in the classpath.
.receivedMessages().every().body() .content(is(resource("path/to/expected/file"))Will check if the content of the body of every message is exactly the same as the file resource available in the classpath.
matcher
- the assertion to apply on raw contentpublic FluentPartAssert<P> contentType(org.hamcrest.Matcher<? super String> matcher)
.receivedMessages().message(0).body() .contentType(is("text/html"))Will check if the content-type of the body of the first message is exactly "text/html".
.receivedMessages().every().body() .contentType(is("text/html"))Will check if the content-type of the body of every message is exactly "text/html".
matcher
- the assertion to apply on content-typepublic FluentPartAssert<P> description(org.hamcrest.Matcher<? super String> matcher)
.receivedMessages().message(0).body() .description(is("foo bar"))Will check if the description of the body of the first message is exactly "foo bar".
.receivedMessages().every().body() .description(is("foo bar"))Will check if the description of the body of every message is exactly "foo bar".
matcher
- the assertion to apply on descriptionpublic FluentPartAssert<P> disposition(org.hamcrest.Matcher<? super String> matcher)
.receivedMessages().message(0).body() .disposition(is(INLINE_DISPOSITION))Will check if the disposition of the body of the first message is exactly "inline".
.receivedMessages().every().body() .disposition(is(INLINE_DISPOSITION))Will check if the disposition of the body of every message is exactly "inline".
matcher
- the assertion to apply on dispositionpublic FluentPartAssert<P> filename(org.hamcrest.Matcher<? super String> matcher)
.receivedMessages().message(0).attachment(0) .filename(is("foo.pdf"))Will check if the filename of the first attachment of the first message is exactly "foo.pdf".
.receivedMessages().every().attachment(0) .filename(is("foo.pdf"))Will check if the filename of the first attachment of every message is exactly "foo.pdf".
matcher
- the assertion to apply on filenamepublic FluentPartAssert<P> headers(org.hamcrest.Matcher<? super Iterable<javax.mail.Header>> matcher)
.receivedMessages().message(0).attachment(0) .headers(hasItem(new Header("name", "value")))Will check if the headers of the first attachment of the first message contains a header with name "name" and value "value".
.receivedMessages().every().attachment(0) .header(hasItem(new Header("name", "value")))Will check if the headers of the first attachment of every message is contains a header with name "name" and value "value".
matcher
- the assertion to apply on headerspublic FluentPartAssert<P> header(String headerName, org.hamcrest.Matcher<? super Iterable<String>> matcher)
.receivedMessages().message(0).attachment(0) .header("Content-ID", contains("foo"))Will check if the "Content-ID" header of the first attachment of the first message values "foo".
.receivedMessages().every().attachment(0) .header("Content-ID", contains("foo"))Will check if the "Content-ID" header of the first attachment of every message values "foo".
headerName
- the name of the header to checkmatcher
- the assertion to apply on the header headerCopyright © 2021. All rights reserved.