From 97d67cb5574eca946a452135d8957e9196cb2fcd Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Thu, 2 Jun 2016 20:51:48 +0100 Subject: [PATCH] WiserAssertions: apply checkstyle rule MultipleStringLiterals --- .../kemitix/wiser/assertions/WiserAssertions.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/main/java/net/kemitix/wiser/assertions/WiserAssertions.java b/src/main/java/net/kemitix/wiser/assertions/WiserAssertions.java index 6bce8a6..e583c72 100644 --- a/src/main/java/net/kemitix/wiser/assertions/WiserAssertions.java +++ b/src/main/java/net/kemitix/wiser/assertions/WiserAssertions.java @@ -40,6 +40,9 @@ import java.util.function.Supplier; */ public final class WiserAssertions { + private static final String ERROR_MESSAGE_SUBJECT + = "No message with subject [{0}] found!"; + /** * The messages received by Wiser. */ @@ -105,9 +108,8 @@ public final class WiserAssertions { public WiserAssertions withSubject(final String subject) { Predicate predicate = m -> subject.equals(unchecked(getMimeMessage(m)::getSubject)); - findFirstOrElseThrow(predicate, - assertionError("No message with subject [{0}] found!", - subject)); + findFirstOrElseThrow(predicate, assertionError(ERROR_MESSAGE_SUBJECT, + subject)); return this; } @@ -123,9 +125,8 @@ public final class WiserAssertions { Predicate predicate = m -> unchecked(getMimeMessage(m)::getSubject) .contains(subject); - findFirstOrElseThrow(predicate, - assertionError("No message with subject [{0}] found!", - subject)); + findFirstOrElseThrow(predicate, assertionError(ERROR_MESSAGE_SUBJECT, + subject)); return this; }