WiserAssertions: apply checkstyle rule MultipleStringLiterals

This commit is contained in:
Paul Campbell 2016-06-02 20:51:48 +01:00
parent 79032c0dd8
commit 97d67cb557

View file

@ -40,6 +40,9 @@ import java.util.function.Supplier;
*/ */
public final class WiserAssertions { public final class WiserAssertions {
private static final String ERROR_MESSAGE_SUBJECT
= "No message with subject [{0}] found!";
/** /**
* The messages received by Wiser. * The messages received by Wiser.
*/ */
@ -105,9 +108,8 @@ public final class WiserAssertions {
public WiserAssertions withSubject(final String subject) { public WiserAssertions withSubject(final String subject) {
Predicate<WiserMessage> predicate Predicate<WiserMessage> predicate
= m -> subject.equals(unchecked(getMimeMessage(m)::getSubject)); = m -> subject.equals(unchecked(getMimeMessage(m)::getSubject));
findFirstOrElseThrow(predicate, findFirstOrElseThrow(predicate, assertionError(ERROR_MESSAGE_SUBJECT,
assertionError("No message with subject [{0}] found!", subject));
subject));
return this; return this;
} }
@ -123,9 +125,8 @@ public final class WiserAssertions {
Predicate<WiserMessage> predicate Predicate<WiserMessage> predicate
= m -> unchecked(getMimeMessage(m)::getSubject) = m -> unchecked(getMimeMessage(m)::getSubject)
.contains(subject); .contains(subject);
findFirstOrElseThrow(predicate, findFirstOrElseThrow(predicate, assertionError(ERROR_MESSAGE_SUBJECT,
assertionError("No message with subject [{0}] found!", subject));
subject));
return this; return this;
} }