comparator, final Object name) {
}
}
- verification().check(result, MessageKeys.SORTED_BY, name);
+ verification().report(result, MessageKeys.SORTED_BY, name);
return chain();
}
diff --git a/src/main/java/io/skelp/verifier/type/base/BaseTimeVerifier.java b/src/main/java/io/skelp/verifier/type/base/BaseTimeVerifier.java
index 649b59e..d3e4586 100644
--- a/src/main/java/io/skelp/verifier/type/base/BaseTimeVerifier.java
+++ b/src/main/java/io/skelp/verifier/type/base/BaseTimeVerifier.java
@@ -83,7 +83,7 @@ public V sameDayAs(final T other) {
calendar1.get(Calendar.YEAR) == calendar2.get(Calendar.YEAR) &&
calendar1.get(Calendar.DAY_OF_YEAR) == calendar2.get(Calendar.DAY_OF_YEAR));
- verification().check(result, MessageKeys.SAME_DAY_AS, other);
+ verification().report(result, MessageKeys.SAME_DAY_AS, other);
return chain();
}
@@ -114,7 +114,7 @@ public V sameEraAs(final T other) {
final boolean result = calendar1 != null && calendar2 != null &&
calendar1.get(Calendar.ERA) == calendar2.get(Calendar.ERA);
- verification().check(result, MessageKeys.SAME_ERA_AS, other);
+ verification().report(result, MessageKeys.SAME_ERA_AS, other);
return chain();
}
@@ -149,7 +149,7 @@ public V sameHourAs(final T other) {
calendar1.get(Calendar.DAY_OF_YEAR) == calendar2.get(Calendar.DAY_OF_YEAR) &&
calendar1.get(Calendar.HOUR_OF_DAY) == calendar2.get(Calendar.HOUR_OF_DAY));
- verification().check(result, MessageKeys.SAME_HOUR_AS, other);
+ verification().report(result, MessageKeys.SAME_HOUR_AS, other);
return chain();
}
@@ -185,7 +185,7 @@ public V sameMinuteAs(final T other) {
calendar1.get(Calendar.HOUR_OF_DAY) == calendar2.get(Calendar.HOUR_OF_DAY) &&
calendar1.get(Calendar.MINUTE) == calendar2.get(Calendar.MINUTE));
- verification().check(result, MessageKeys.SAME_MINUTE_AS, other);
+ verification().report(result, MessageKeys.SAME_MINUTE_AS, other);
return chain();
}
@@ -219,7 +219,7 @@ public V sameMonthAs(final T other) {
calendar1.get(Calendar.YEAR) == calendar2.get(Calendar.YEAR) &&
calendar1.get(Calendar.MONTH) == calendar2.get(Calendar.MONTH));
- verification().check(result, MessageKeys.SAME_MONTH_AS, other);
+ verification().report(result, MessageKeys.SAME_MONTH_AS, other);
return chain();
}
@@ -256,7 +256,7 @@ public V sameSecondAs(final T other) {
calendar1.get(Calendar.MINUTE) == calendar2.get(Calendar.MINUTE) &&
calendar1.get(Calendar.SECOND) == calendar2.get(Calendar.SECOND));
- verification().check(result, MessageKeys.SAME_SECOND_AS, other);
+ verification().report(result, MessageKeys.SAME_SECOND_AS, other);
return chain();
}
@@ -288,7 +288,7 @@ public V sameTimeAs(final T other) {
final boolean result = calendar1 != null && calendar2 != null &&
calendar1.getTimeInMillis() == calendar2.getTimeInMillis();
- verification().check(result, MessageKeys.SAME_TIME_AS, other);
+ verification().report(result, MessageKeys.SAME_TIME_AS, other);
return chain();
}
@@ -322,7 +322,7 @@ public V sameWeekAs(final T other) {
calendar1.get(Calendar.YEAR) == calendar2.get(Calendar.YEAR) &&
calendar1.get(Calendar.WEEK_OF_YEAR) == calendar2.get(Calendar.WEEK_OF_YEAR));
- verification().check(result, MessageKeys.SAME_WEEK_AS, other);
+ verification().report(result, MessageKeys.SAME_WEEK_AS, other);
return chain();
}
@@ -355,7 +355,7 @@ public V sameYearAs(final T other) {
(calendar1.get(Calendar.ERA) == calendar2.get(Calendar.ERA) &&
calendar1.get(Calendar.YEAR) == calendar2.get(Calendar.YEAR));
- verification().check(result, MessageKeys.SAME_YEAR_AS, other);
+ verification().report(result, MessageKeys.SAME_YEAR_AS, other);
return chain();
}
diff --git a/src/main/java/io/skelp/verifier/verification/DefaultVerificationProvider.java b/src/main/java/io/skelp/verifier/verification/DefaultVerificationProvider.java
index 5314de3..8dc72c4 100644
--- a/src/main/java/io/skelp/verifier/verification/DefaultVerificationProvider.java
+++ b/src/main/java/io/skelp/verifier/verification/DefaultVerificationProvider.java
@@ -26,6 +26,8 @@
import io.skelp.verifier.message.locale.LocaleContext;
import io.skelp.verifier.message.locale.LocaleContextProvider;
import io.skelp.verifier.service.Services;
+import io.skelp.verifier.verification.report.ReportExecutor;
+import io.skelp.verifier.verification.report.ReportExecutorProvider;
/**
*
@@ -42,8 +44,9 @@ public final class DefaultVerificationProvider implements VerificationProvider {
public Verification getVerification(final T value, final Object name) {
final LocaleContext localeContext = Services.findFirstNonNullForWeightedService(LocaleContextProvider.class, LocaleContextProvider::getLocaleContext);
final MessageSource messageSource = Services.findFirstNonNullForWeightedService(MessageSourceProvider.class, MessageSourceProvider::getMessageSource);
+ final ReportExecutor reportExecutor = Services.findFirstNonNullForWeightedService(ReportExecutorProvider.class, ReportExecutorProvider::getReportExecutor);
- return new SimpleVerification<>(localeContext, messageSource, value, name);
+ return new SimpleVerification<>(localeContext, messageSource, reportExecutor, value, name);
}
@Override
diff --git a/src/main/java/io/skelp/verifier/verification/SimpleVerification.java b/src/main/java/io/skelp/verifier/verification/SimpleVerification.java
index def822c..ef5b481 100644
--- a/src/main/java/io/skelp/verifier/verification/SimpleVerification.java
+++ b/src/main/java/io/skelp/verifier/verification/SimpleVerification.java
@@ -21,12 +21,14 @@
*/
package io.skelp.verifier.verification;
-import java.util.function.Supplier;
-
import io.skelp.verifier.VerifierException;
import io.skelp.verifier.message.MessageKey;
import io.skelp.verifier.message.MessageSource;
import io.skelp.verifier.message.locale.LocaleContext;
+import io.skelp.verifier.verification.report.KeyMessageHolder;
+import io.skelp.verifier.verification.report.MessageHolder;
+import io.skelp.verifier.verification.report.ReportExecutor;
+import io.skelp.verifier.verification.report.StringMessageHolder;
/**
*
@@ -44,6 +46,7 @@ public final class SimpleVerification implements Verification {
private final MessageSource messageSource;
private final Object name;
private boolean negated;
+ private final ReportExecutor reportExecutor;
private final T value;
/**
@@ -56,38 +59,38 @@ public final class SimpleVerification implements Verification {
* @param messageSource
* the {@link MessageSource} to be used to lookup and/or format the messages for any {@link
* VerifierException VerifierExceptions}
+ * @param reportExecutor
+ * the {@link ReportExecutor} to be used to report verification results
* @param value
* the value being verified
* @param name
* the optional name used to represent {@code value}
*/
- public SimpleVerification(final LocaleContext localeContext, final MessageSource messageSource, final T value, final Object name) {
+ public SimpleVerification(final LocaleContext localeContext, final MessageSource messageSource, final ReportExecutor reportExecutor, final T value, final Object name) {
this.localeContext = localeContext;
this.messageSource = messageSource;
+ this.reportExecutor = reportExecutor;
this.value = value;
this.name = name;
}
@Override
- public SimpleVerification check(final boolean result, final MessageKey key, final Object... args) {
- return check(result, () -> getMessageSource().getMessage(this, key, args));
+ public SimpleVerification report(final boolean result, final MessageKey key, final Object... args) {
+ return report(result, new KeyMessageHolder(key, args));
}
@Override
- public SimpleVerification check(final boolean result, final String message, final Object... args) {
- return check(result, () -> getMessageSource().getMessage(this, message, args));
+ public SimpleVerification report(final boolean result, final String message, final Object... args) {
+ return report(result, new StringMessageHolder(message, args));
}
- private SimpleVerification check(final boolean result, final Supplier messageSupplier) {
- if (result && isNegated() || !result && !isNegated()) {
- final String errorMessage = messageSupplier.get();
+ private SimpleVerification report(final boolean result, final MessageHolder messageHolder) {
+ try {
+ reportExecutor.execute(this, result, messageHolder);
+ } finally {
setNegated(false);
-
- throw new VerifierException(errorMessage);
}
- setNegated(false);
-
return this;
}
@@ -116,6 +119,11 @@ public void setNegated(final boolean negated) {
this.negated = negated;
}
+ @Override
+ public ReportExecutor getReportExecutor() {
+ return reportExecutor;
+ }
+
@Override
public T getValue() {
return value;
diff --git a/src/main/java/io/skelp/verifier/verification/Verification.java b/src/main/java/io/skelp/verifier/verification/Verification.java
index 5116110..9a6b459 100644
--- a/src/main/java/io/skelp/verifier/verification/Verification.java
+++ b/src/main/java/io/skelp/verifier/verification/Verification.java
@@ -25,6 +25,9 @@
import io.skelp.verifier.message.MessageKey;
import io.skelp.verifier.message.MessageSource;
import io.skelp.verifier.message.locale.LocaleContext;
+import io.skelp.verifier.verification.report.AssertionReporter;
+import io.skelp.verifier.verification.report.ReportExecutor;
+import io.skelp.verifier.verification.report.Reporter;
/**
*
@@ -44,13 +47,14 @@ public interface Verification {
/**
*
- * Checks the specified {@code result} to determine whether it passes verification.
+ * Reports the specified {@code result}, which may determine whether it passes verification.
*
*
- * {@code result} will pass it is {@literal true} and this {@link Verification} has not be negated or if it has been
- * negated and {@code result} is {@literal false}. If it does not pass, a {@link VerifierException} will be thrown
- * with a suitable localized message, which can be enhanced by providing an optional {@code key} and format
- * {@code args}.
+ * The {@code result} will pass depending on the {@link Reporter Reporters}. That said; generally, the default
+ * reporter ({@link AssertionReporter}) will pass {@code result} if it is {@literal true} and this
+ * {@link Verification} has not be negated or if it has been negated and {@code result} is {@literal false}. If it
+ * does not pass, a {@link VerifierException} will be thrown with a suitable localized message, which can be
+ * enhanced by providing an optional {@code key} and format {@code args}.
*
*
* This {@link Verification} will no longer be negated as a result of calling this method, regardless of whether
@@ -66,20 +70,22 @@ public interface Verification {
* the optional format arguments which are used to format the localized message
* @return A reference to this {@link Verification} for chaining purposes.
* @throws VerifierException
- * If {@code result} does not pass verification or if a problem occurs while formatting the error message.
- * @see #check(boolean, String, Object...)
+ * If any {@link Reporter} deems that {@code result} should not pass verification.
+ * @see #report(boolean, String, Object...)
* @since 0.2.0
*/
- Verification check(boolean result, MessageKey key, Object... args);
+ Verification report(boolean result, MessageKey key, Object... args);
/**
*
- * Checks the specified {@code result} to determine whether it passes verification.
+ * Reports the specified {@code result}, which may determine whether it passes verification.
*
*
- * {@code result} will pass it is {@literal true} and this {@link Verification} has not be negated or if it has been
- * negated and {@code result} is {@literal false}. If it does not pass, a {@link VerifierException} will be thrown
- * with a suitable message, which can be enhanced by providing an optional {@code message} and format {@code args}.
+ * The {@code result} will pass depending on the {@link Reporter Reporters}. That said; generally, the default
+ * reporter ({@link AssertionReporter}) will pass {@code result} if it is {@literal true} and this
+ * {@link Verification} has not be negated or if it has been negated and {@code result} is {@literal false}. If it
+ * does not pass, a {@link VerifierException} will be thrown with a suitable localized message, which can be
+ * enhanced by providing an optional (unlocalized) {@code message} and format {@code args}.
*
*
* This {@link Verification} will no longer be negated as a result of calling this method, regardless of whether
@@ -94,15 +100,16 @@ public interface Verification {
* the optional format arguments which are used to format {@code message}
* @return A reference to this {@link Verification} for chaining purposes.
* @throws VerifierException
- * If {@code result} does not pass verification or if a problem occurs while formatting the error message.
- * @see #check(boolean, MessageKey, Object...)
+ * If any {@link Reporter} deems that {@code result} should not pass verification.
+ * @see #report(boolean, MessageKey, Object...)
+ * @since 0.2.0
*/
- Verification check(boolean result, String message, Object... args);
+ Verification report(boolean result, String message, Object... args);
/**
*
* Returns the {@link LocaleContext} that is being used by this {@link Verification} to lookup and format messages
- * for any {@link VerifierException VerifierExceptions} that are thrown by {@link #check}.
+ * for any {@link VerifierException VerifierExceptions} that are thrown by a {@link Reporter}.
*
*
* @return The {@link LocaleContext}.
@@ -113,7 +120,7 @@ public interface Verification {
/**
*
* Returns the message source that is being used by this {@link Verification} to lookup and/or format the messages
- * for any {@link VerifierException VerifierExceptions} that are thrown by {@link #check}.
+ * for any {@link VerifierException VerifierExceptions} that are thrown by a {@link Reporter}.
*
*
* @return The {@link MessageSource}.
@@ -132,8 +139,7 @@ public interface Verification {
/**
*
- * Returns whether the next result that is passed to {@link #check(boolean, String, Object...)} is negated for this
- * {@link Verification}.
+ * Returns whether the next result that is passed to {@link #report} is negated for this {@link Verification}.
*
*
* @return {@literal true} if the next result will be negated; otherwise {@literal false}.
@@ -142,8 +148,8 @@ public interface Verification {
/**
*
- * Sets whether the next result that is passed to {@link #check(boolean, String, Object...)} is negated for this
- * {@link Verification} to {@code negated}.
+ * Sets whether the next result that is passed to {@link #report} is negated for this {@link Verification} to
+ * {@code negated}.
*
*
* @param negated
@@ -151,6 +157,17 @@ public interface Verification {
*/
void setNegated(boolean negated);
+ /**
+ *
+ * Returns the report executor that is being used by this {@link Verification} to execute {@link Reporter Reporters}
+ * for a verification result.
+ *
+ *
+ * @return The {@link ReportExecutor}.
+ * @since 0.2.0
+ */
+ ReportExecutor getReportExecutor();
+
/**
*
* Returns the value for this {@link Verification}.
diff --git a/src/main/java/io/skelp/verifier/verification/VerificationProvider.java b/src/main/java/io/skelp/verifier/verification/VerificationProvider.java
index ea35f74..e342fdc 100644
--- a/src/main/java/io/skelp/verifier/verification/VerificationProvider.java
+++ b/src/main/java/io/skelp/verifier/verification/VerificationProvider.java
@@ -29,6 +29,16 @@
* Provides {@link Verification} instances to be used to provide context to verifications based on a given value and
* optional name.
*
+ *
+ * {@code VerificationProviders} are registered via Java's SPI, so in order to register a custom
+ * {@code VerificationProvider} projects should contain should create a
+ * {@code io.skelp.verifier.verification.verification.VerificationProvider} file within {@code META-INF/services}
+ * listing the class reference for each custom {@code VerificationProvider} (e.g.
+ * {@code com.example.verifier.MyCustomVerificationProvider}) on separate lines. {@code VerificationProviders} are also
+ * {@link Weighted}, which means that they are loaded in priority order (the lower the weight, the higher the priority).
+ * Verifier has a built-in default {@code VerificationProvider} which is given a low priority (i.e.
+ * {@value #DEFAULT_IMPLEMENTATION_WEIGHT}) to allow custom implementations to be easily ordered around it.
+ *
*
* @author Alasdair Mercer
* @since 0.2.0
diff --git a/src/main/java/io/skelp/verifier/verification/report/AbstractReportExecutor.java b/src/main/java/io/skelp/verifier/verification/report/AbstractReportExecutor.java
new file mode 100644
index 0000000..ff4e3dc
--- /dev/null
+++ b/src/main/java/io/skelp/verifier/verification/report/AbstractReportExecutor.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2017 Alasdair Mercer, Skelp
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package io.skelp.verifier.verification.report;
+
+import io.skelp.verifier.verification.Verification;
+
+/**
+ *
+ * An abstract implementation of {@link AbstractReportExecutor} that implements
+ * {@link #execute(Verification, boolean, MessageHolder)} to meet the contract while only requiring implementations to
+ * provide the list of {@link Reporter Reporters} to be executed.
+ *
+ *
+ * @author Alasdair Mercer
+ * @since 0.2.0
+ */
+public abstract class AbstractReportExecutor implements ReportExecutor {
+
+ @Override
+ public void execute(final Verification> verification, final boolean result, final MessageHolder messageHolder) {
+ for (final Reporter reporter : getReporters()) {
+ if (!reporter.report(verification, result, messageHolder)) {
+ break;
+ }
+ }
+ }
+}
diff --git a/src/main/java/io/skelp/verifier/verification/report/AssertionReporter.java b/src/main/java/io/skelp/verifier/verification/report/AssertionReporter.java
new file mode 100644
index 0000000..8a3474a
--- /dev/null
+++ b/src/main/java/io/skelp/verifier/verification/report/AssertionReporter.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2017 Alasdair Mercer, Skelp
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package io.skelp.verifier.verification.report;
+
+import io.skelp.verifier.VerifierException;
+import io.skelp.verifier.verification.Verification;
+
+/**
+ *
+ * An implementation of {@link Reporter} that simply asserts that the given result passes verification.
+ *
+ *
+ * Basically, a {@link VerifierException} will be thrown in the following cases:
+ *
+ *
+ * - Result is {@literal true} and the {@link Verification} is negated
+ * - Result is {@literal false} and the {@link Verification} is not negated
+ *
+ *
+ * For this reason, this is the ideal {@link Reporter} to be last in the chain as it does what Verifier was designed to
+ * do.
+ *
+ *
+ * @author Alasdair Mercer
+ * @since 0.2.0
+ */
+public final class AssertionReporter implements Reporter {
+
+ @Override
+ public boolean report(final Verification> verification, final boolean result, final MessageHolder messageHolder) {
+ if (result && verification.isNegated() || !result && !verification.isNegated()) {
+ throw new VerifierException(messageHolder.getMessage(verification));
+ }
+
+ return true;
+ }
+
+ @Override
+ public int getWeight() {
+ return DEFAULT_IMPLEMENTATION_WEIGHT;
+ }
+}
diff --git a/src/main/java/io/skelp/verifier/verification/report/DefaultReportExecutorProvider.java b/src/main/java/io/skelp/verifier/verification/report/DefaultReportExecutorProvider.java
new file mode 100644
index 0000000..0e4830e
--- /dev/null
+++ b/src/main/java/io/skelp/verifier/verification/report/DefaultReportExecutorProvider.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2017 Alasdair Mercer, Skelp
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package io.skelp.verifier.verification.report;
+
+import java.util.List;
+
+import io.skelp.verifier.service.Services;
+
+/**
+ *
+ * The default implementation of {@link ReportExecutorProvider} which provides an instance of
+ * {@link SimpleReportExecutor} populated with all discoverable {@link Reporter Reporters}.
+ *
+ *
+ * @author Alasdair Mercer
+ * @since 0.2.0
+ */
+public final class DefaultReportExecutorProvider implements ReportExecutorProvider {
+
+ @Override
+ public ReportExecutor getReportExecutor() {
+ final List reporters = Services.getWeightedServices(Reporter.class);
+
+ return new SimpleReportExecutor(reporters);
+ }
+
+ @Override
+ public int getWeight() {
+ return DEFAULT_IMPLEMENTATION_WEIGHT;
+ }
+}
diff --git a/src/main/java/io/skelp/verifier/verification/report/KeyMessageHolder.java b/src/main/java/io/skelp/verifier/verification/report/KeyMessageHolder.java
new file mode 100644
index 0000000..abed0c0
--- /dev/null
+++ b/src/main/java/io/skelp/verifier/verification/report/KeyMessageHolder.java
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2017 Alasdair Mercer, Skelp
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package io.skelp.verifier.verification.report;
+
+import io.skelp.verifier.message.MessageKey;
+import io.skelp.verifier.message.MessageSource;
+import io.skelp.verifier.verification.Verification;
+
+/**
+ *
+ * An immutable implementation of {@link MessageHolder} that contains the {@link MessageKey} relating to a localized
+ * message message and format arguments which are later passed to
+ * {@link MessageSource#getMessage(Verification, MessageKey, Object[])}.
+ *
+ *
+ * @author Alasdair Mercer
+ * @since 0.2.0
+ */
+public final class KeyMessageHolder implements MessageHolder {
+
+ private final Object[] args;
+ private final MessageKey key;
+
+ /**
+ *
+ * Creates an instance of {@link KeyMessageHolder} for the optional message {@code key} and format {@code args}
+ * provided.
+ *
+ *
+ * @param key
+ * the optional {@link MessageKey} which provides a more detailed localized explanation of what was
+ * verified
+ * @param args
+ * the optional format arguments which are used to format the localized message
+ */
+ public KeyMessageHolder(final MessageKey key, final Object[] args) {
+ this.key = key;
+ this.args = args;
+ }
+
+ @Override
+ public String getMessage(final Verification> verification) {
+ return verification.getMessageSource().getMessage(verification, key, args);
+ }
+}
diff --git a/src/main/java/io/skelp/verifier/verification/report/MessageHolder.java b/src/main/java/io/skelp/verifier/verification/report/MessageHolder.java
new file mode 100644
index 0000000..60234c2
--- /dev/null
+++ b/src/main/java/io/skelp/verifier/verification/report/MessageHolder.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2017 Alasdair Mercer, Skelp
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package io.skelp.verifier.verification.report;
+
+import io.skelp.verifier.VerifierException;
+import io.skelp.verifier.verification.Verification;
+
+/**
+ *
+ * Holds a verification message to be retrieved as and when needed as a complete error message.
+ *
+ *
+ * @author Alasdair Mercer
+ * @since 0.2.0
+ */
+public interface MessageHolder {
+
+ /**
+ *
+ * Returns the complete error message being held by this {@link MessageHolder}.
+ *
+ *
+ * @param verification
+ * the current {@link Verification}
+ * @return The complete error message.
+ * @throws VerifierException
+ * If a problem occurs while trying to retrieve the message.
+ */
+ String getMessage(Verification> verification);
+}
diff --git a/src/main/java/io/skelp/verifier/verification/report/ReportExecutor.java b/src/main/java/io/skelp/verifier/verification/report/ReportExecutor.java
new file mode 100644
index 0000000..89f0cfe
--- /dev/null
+++ b/src/main/java/io/skelp/verifier/verification/report/ReportExecutor.java
@@ -0,0 +1,72 @@
+/*
+ * Copyright (C) 2017 Alasdair Mercer, Skelp
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package io.skelp.verifier.verification.report;
+
+import java.util.List;
+
+import io.skelp.verifier.VerifierException;
+import io.skelp.verifier.verification.Verification;
+
+/**
+ *
+ * Responsible for executing a chain of {@link Reporter Reporters} one after the other.
+ *
+ *
+ * @author Alasdair Mercer
+ * @since 0.2.0
+ */
+public interface ReportExecutor {
+
+ /**
+ *
+ * Executes all of the {@link Reporter Reporters} for this {@link ReportExecutor} sequentially with the information
+ * provided.
+ *
+ *
+ * Any of the {@link Reporter Reporters} may throw a {@link VerifierException} with a suitable message held in the
+ * {@code messageHolder} provided should they deem that {@code result} does not pass verification, breaking the
+ * chain, meaning none of the remaining {@link Reporter Reporters} within the chain will be executed. The chain can
+ * also be broken should {@link Reporter#report(Verification, boolean, MessageHolder)} return {@literal false} at
+ * any time.
+ *
+ *
+ * @param verification
+ * the current {@link Verification}
+ * @param result
+ * the result of the verification to be reported
+ * @param messageHolder
+ * the {@link MessageHolder} containing the optional message which provides a more detailed explanation of
+ * what was verified
+ * @throws VerifierException
+ * If any of the {@link Reporter Reporters} deem that {@code result} should not pass for verification.
+ */
+ void execute(Verification> verification, boolean result, MessageHolder messageHolder);
+
+ /**
+ *
+ * Returns the reporters to be executed by this {@link ReportExecutor}.
+ *
+ *
+ * @return The {@code List} of {@link Reporter Reporters} to be executed.
+ */
+ List getReporters();
+}
diff --git a/src/main/java/io/skelp/verifier/verification/report/ReportExecutorProvider.java b/src/main/java/io/skelp/verifier/verification/report/ReportExecutorProvider.java
new file mode 100644
index 0000000..f20509c
--- /dev/null
+++ b/src/main/java/io/skelp/verifier/verification/report/ReportExecutorProvider.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2017 Alasdair Mercer, Skelp
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package io.skelp.verifier.verification.report;
+
+import io.skelp.verifier.VerifierException;
+import io.skelp.verifier.service.Weighted;
+
+/**
+ *
+ * Provides {@link ReportExecutor} instances to be used to execute {@link Reporter Reporters} for a given verification
+ * result, potentially to determine whether it passes.
+ *
+ *
+ * {@code ReportExecutorProviders} are registered via Java's SPI, so in order to register a custom
+ * {@code ReportExecutorProvider} projects should contain should create a
+ * {@code io.skelp.verifier.verification.report.ReportExecutorProvider} file within {@code META-INF/services} listing
+ * the class reference for each custom {@code ReportExecutorProvider} (e.g.
+ * {@code com.example.verifier.MyCustomReportExecutorProvider}) on separate lines. {@code ReportExecutorProviders} are
+ * also {@link Weighted}, which means that they are loaded in priority order (the lower the weight, the higher the
+ * priority). Verifier has a built-in default {@code ReportExecutorProvider} which is given a low priority (i.e.
+ * {@value #DEFAULT_IMPLEMENTATION_WEIGHT}) to allow custom implementations to be easily ordered around it.
+ *
+ *
+ * @author Alasdair Mercer
+ * @since 0.2.0
+ */
+public interface ReportExecutorProvider extends Weighted {
+
+ /**
+ *
+ * Returns an instance of {@link ReportExecutor}.
+ *
+ *
+ * @return The {@link ReportExecutor} instance.
+ * @throws VerifierException
+ * If a problem occurs while providing the {@link ReportExecutor} instance.
+ */
+ ReportExecutor getReportExecutor();
+}
diff --git a/src/main/java/io/skelp/verifier/verification/report/Reporter.java b/src/main/java/io/skelp/verifier/verification/report/Reporter.java
new file mode 100644
index 0000000..ab63aaa
--- /dev/null
+++ b/src/main/java/io/skelp/verifier/verification/report/Reporter.java
@@ -0,0 +1,83 @@
+/*
+ * Copyright (C) 2017 Alasdair Mercer, Skelp
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package io.skelp.verifier.verification.report;
+
+import io.skelp.verifier.VerifierException;
+import io.skelp.verifier.service.Weighted;
+import io.skelp.verifier.verification.Verification;
+
+/**
+ *
+ * Reports a given result, which may determine whether it passes verification, which are generally executed via a
+ * {@link ReportExecutor}. It should not modify the state of the {@link Verification} in any way.
+ *
+ *
+ * If a {@code Reporter} determines that the result has not passed verification, then it should throw a
+ * {@link VerifierException} with a suitable message provided by a {@link MessageHolder}. However they are not required
+ * to determine whether the verification has passed and can report differently instead (e.g. logging, profiling).
+ *
+ *
+ * When a {@code Reporter} is executed by a {@link ReportExecutor}, it can control whether the next {@code Reporter} in
+ * the chain gets executed.
+ *
+ *
+ * {@code Reporters} are registered via Java's SPI, so in order to register a custom {@code Reporter} projects should
+ * contain should create a {@code io.skelp.verifier.verification.report.Reporter} file within {@code META-INF/services}
+ * listing the class reference for each custom {@code Reporter} (e.g. {@code com.example.verifier.MyCustomReporter}) on
+ * separate lines. {@code Reporters} are also {@link Weighted}, which means that they are loaded in priority order (the
+ * lower the weight, the higher the priority). Verifier has a built-in default {@code Reporter} which is given a low
+ * priority (i.e. {@value #DEFAULT_IMPLEMENTATION_WEIGHT}) to allow custom implementations to be easily ordered around
+ * it.
+ *
+ *
+ * @author Alasdair Mercer
+ * @since 0.2.0
+ */
+public interface Reporter extends Weighted {
+
+ /**
+ *
+ * Reports the specified {@code result}, which may determine whether it passes for the given verification.
+ *
+ *
+ * If this {@link Reporter} determines that {@code result} has not passed verification, a {@link VerifierException}
+ * will be thrown with a suitable message held in the {@code messageHolder} provided.
+ *
+ *
+ * When this method is invoked by a {@link ReportExecutor}, the value returned by this method can be used to control
+ * whether the next {@link Reporter} in the chain is executed.
+ *
+ *
+ * @param verification
+ * the current {@link Verification}
+ * @param result
+ * the result of the verification
+ * @param messageHolder
+ * the {@link MessageHolder} containing the optional message which provides a more detailed explanation of
+ * what was verified
+ * @return {@literal true} if the next {@link Reporter} in the chain of the {@link ReportExecutor} should be
+ * executed; otherwise {@literal false}.
+ * @throws VerifierException
+ * If deemed that {@code result} should not pass for verification.
+ */
+ boolean report(Verification> verification, boolean result, MessageHolder messageHolder);
+}
diff --git a/src/main/java/io/skelp/verifier/verification/report/SimpleReportExecutor.java b/src/main/java/io/skelp/verifier/verification/report/SimpleReportExecutor.java
new file mode 100644
index 0000000..dc49242
--- /dev/null
+++ b/src/main/java/io/skelp/verifier/verification/report/SimpleReportExecutor.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2017 Alasdair Mercer, Skelp
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package io.skelp.verifier.verification.report;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ *
+ * A simple immutable implementation of {@link ReportExecutor}.
+ *
+ *
+ * @author Alasdair Mercer
+ * @since 0.2.0
+ */
+public final class SimpleReportExecutor extends AbstractReportExecutor {
+
+ private final List reporters;
+
+ /**
+ *
+ * Creates an instance of {@link SimpleReportExecutor} for the {@code reporters} provided.
+ *
+ *
+ * @param reporters
+ * the {@code List} of {@link Reporter Reporters} to be used
+ */
+ public SimpleReportExecutor(final List reporters) {
+ this.reporters = new ArrayList<>(reporters);
+ }
+
+ @Override
+ public List getReporters() {
+ return reporters;
+ }
+}
diff --git a/src/main/java/io/skelp/verifier/verification/report/StringMessageHolder.java b/src/main/java/io/skelp/verifier/verification/report/StringMessageHolder.java
new file mode 100644
index 0000000..6e60aff
--- /dev/null
+++ b/src/main/java/io/skelp/verifier/verification/report/StringMessageHolder.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2017 Alasdair Mercer, Skelp
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package io.skelp.verifier.verification.report;
+
+import io.skelp.verifier.message.MessageSource;
+import io.skelp.verifier.verification.Verification;
+
+/**
+ *
+ * An immutable implementation of {@link MessageHolder} that contains an unlocalized string message and format arguments
+ * which are later passed to {@link MessageSource#getMessage(Verification, String, Object[])}.
+ *
+ *
+ * @author Alasdair Mercer
+ * @since 0.2.0
+ */
+public final class StringMessageHolder implements MessageHolder {
+
+ private final Object[] args;
+ private final String message;
+
+ /**
+ *
+ * Creates an instance of {@link StringMessageHolder} for the optional {@code message} and format {@code args}
+ * provided.
+ *
+ *
+ * @param message
+ * the optional message which provides a more detailed explanation of what was verified
+ * @param args
+ * the optional format arguments which are used to format {@code message}
+ */
+ public StringMessageHolder(final String message, final Object[] args) {
+ this.message = message;
+ this.args = args;
+ }
+
+ @Override
+ public String getMessage(final Verification> verification) {
+ return verification.getMessageSource().getMessage(verification, message, args);
+ }
+}
diff --git a/src/main/resources/META-INF/services/io.skelp.verifier.verification.report.ReportExecutorProvider b/src/main/resources/META-INF/services/io.skelp.verifier.verification.report.ReportExecutorProvider
new file mode 100644
index 0000000..335994c
--- /dev/null
+++ b/src/main/resources/META-INF/services/io.skelp.verifier.verification.report.ReportExecutorProvider
@@ -0,0 +1 @@
+io.skelp.verifier.verification.report.DefaultReportExecutorProvider
diff --git a/src/main/resources/META-INF/services/io.skelp.verifier.verification.report.Reporter b/src/main/resources/META-INF/services/io.skelp.verifier.verification.report.Reporter
new file mode 100644
index 0000000..52eaa9a
--- /dev/null
+++ b/src/main/resources/META-INF/services/io.skelp.verifier.verification.report.Reporter
@@ -0,0 +1 @@
+io.skelp.verifier.verification.report.AssertionReporter
diff --git a/src/test/java/io/skelp/verifier/AbstractCustomVerifierTestCase.java b/src/test/java/io/skelp/verifier/AbstractCustomVerifierTestCase.java
index bb2d748..809ff11 100644
--- a/src/test/java/io/skelp/verifier/AbstractCustomVerifierTestCase.java
+++ b/src/test/java/io/skelp/verifier/AbstractCustomVerifierTestCase.java
@@ -86,7 +86,7 @@ private void testEqualToHelper(T value, Object other, boolean expected) {
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().equalTo(other));
- verify(getMockVerification()).check(eq(expected), eq(AbstractCustomVerifier.MessageKeys.EQUAL_TO), getArgsCaptor().capture());
+ verify(getMockVerification()).report(eq(expected), eq(AbstractCustomVerifier.MessageKeys.EQUAL_TO), getArgsCaptor().capture());
assertSame("Passes other for message formatting", other, getArgsCaptor().getValue());
}
@@ -128,7 +128,7 @@ private void testEqualToHelper(T value, Object other, Object name, boolean expec
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().equalTo(other, name));
- verify(getMockVerification()).check(eq(expected), eq(AbstractCustomVerifier.MessageKeys.EQUAL_TO), getArgsCaptor().capture());
+ verify(getMockVerification()).report(eq(expected), eq(AbstractCustomVerifier.MessageKeys.EQUAL_TO), getArgsCaptor().capture());
assertSame("Passes name for message formatting", name, getArgsCaptor().getValue());
}
@@ -185,7 +185,7 @@ private void testEqualToAnyHelper(T value, Object[] others, boolean expected) {
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().equalToAny(others));
- verify(getMockVerification()).check(expected, AbstractCustomVerifier.MessageKeys.EQUAL_TO_ANY, (Object) others);
+ verify(getMockVerification()).report(expected, AbstractCustomVerifier.MessageKeys.EQUAL_TO_ANY, (Object) others);
}
@Test
@@ -212,7 +212,7 @@ private void testHashedAsHelper(T value, int hashCode, boolean expected) {
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().hashedAs(hashCode));
- verify(getMockVerification()).check(eq(expected), eq(AbstractCustomVerifier.MessageKeys.HASHED_AS), getArgsCaptor().capture());
+ verify(getMockVerification()).report(eq(expected), eq(AbstractCustomVerifier.MessageKeys.HASHED_AS), getArgsCaptor().capture());
assertEquals("Passes hash code for message formatting", hashCode, getArgsCaptor().getValue());
}
@@ -252,7 +252,7 @@ private void testInstanceOfHelper(T value, Class> cls, boolean expected) {
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().instanceOf(cls));
- verify(getMockVerification()).check(eq(expected), eq(AbstractCustomVerifier.MessageKeys.INSTANCE_OF), getArgsCaptor().capture());
+ verify(getMockVerification()).report(eq(expected), eq(AbstractCustomVerifier.MessageKeys.INSTANCE_OF), getArgsCaptor().capture());
assertEquals("Passes class for message formatting", cls, getArgsCaptor().getValue());
}
@@ -307,7 +307,7 @@ private void testInstanceOfAllHelper(T value, Class>[] classes, boolean expect
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().instanceOfAll(classes));
- verify(getMockVerification()).check(expected, AbstractCustomVerifier.MessageKeys.INSTANCE_OF_ALL, (Object) classes);
+ verify(getMockVerification()).report(expected, AbstractCustomVerifier.MessageKeys.INSTANCE_OF_ALL, (Object) classes);
}
@Test
@@ -360,7 +360,7 @@ private void testInstanceOfAnyHelper(T value, Class>[] classes, boolean expect
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().instanceOfAny(classes));
- verify(getMockVerification()).check(expected, AbstractCustomVerifier.MessageKeys.INSTANCE_OF_ANY, (Object) classes);
+ verify(getMockVerification()).report(expected, AbstractCustomVerifier.MessageKeys.INSTANCE_OF_ANY, (Object) classes);
}
@Test
@@ -394,7 +394,7 @@ private void testNulledHelper(T value, boolean expected) {
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().nulled());
- verify(getMockVerification()).check(expected, AbstractCustomVerifier.MessageKeys.NULLED);
+ verify(getMockVerification()).report(expected, AbstractCustomVerifier.MessageKeys.NULLED);
}
@Test
@@ -434,7 +434,7 @@ private void testSameAsHelper(T value, Object other, boolean expected) {
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().sameAs(other));
- verify(getMockVerification()).check(eq(expected), eq(AbstractCustomVerifier.MessageKeys.SAME_AS), getArgsCaptor().capture());
+ verify(getMockVerification()).report(eq(expected), eq(AbstractCustomVerifier.MessageKeys.SAME_AS), getArgsCaptor().capture());
assertSame("Passes other for message formatting", other, getArgsCaptor().getValue());
}
@@ -476,7 +476,7 @@ private void testSameAsHelper(T value, Object other, Object name, boolean expect
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().sameAs(other, name));
- verify(getMockVerification()).check(eq(expected), eq(AbstractCustomVerifier.MessageKeys.SAME_AS), getArgsCaptor().capture());
+ verify(getMockVerification()).report(eq(expected), eq(AbstractCustomVerifier.MessageKeys.SAME_AS), getArgsCaptor().capture());
assertSame("Passes name for message formatting", name, getArgsCaptor().getValue());
}
@@ -533,7 +533,7 @@ private void testSameAsAnyHelper(T value, Object[] others, boolean expected) {
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().sameAsAny(others));
- verify(getMockVerification()).check(expected, AbstractCustomVerifier.MessageKeys.SAME_AS_ANY, (Object) others);
+ verify(getMockVerification()).report(expected, AbstractCustomVerifier.MessageKeys.SAME_AS_ANY, (Object) others);
}
@Test
@@ -563,7 +563,7 @@ private void testThatHelper(boolean expected) {
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().that(mockAssertion));
verify(mockAssertion).verify(value);
- verify(getMockVerification()).check(eq(expected), isNull(String.class));
+ verify(getMockVerification()).report(eq(expected), isNull(String.class));
}
@Test
@@ -593,7 +593,7 @@ private void testThatHelper(boolean expected, String message, Object[] args) {
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().that(mockAssertion, message, args));
verify(mockAssertion).verify(value);
- verify(getMockVerification()).check(eq(expected), eq(message), getArgsCaptor().capture());
+ verify(getMockVerification()).report(eq(expected), eq(message), getArgsCaptor().capture());
assertEquals("Passes args for message formatting", Arrays.asList(args), getArgsCaptor().getAllValues());
}
@@ -625,7 +625,7 @@ private void testThatHelper(boolean expected, MessageKey key, Object[] args) {
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().that(mockAssertion, key, args));
verify(mockAssertion).verify(value);
- verify(getMockVerification()).check(eq(expected), eq(key), getArgsCaptor().capture());
+ verify(getMockVerification()).report(eq(expected), eq(key), getArgsCaptor().capture());
assertEquals("Passes args for message formatting", Arrays.asList(args), getArgsCaptor().getAllValues());
}
diff --git a/src/test/java/io/skelp/verifier/CustomVerifierTestCaseBase.java b/src/test/java/io/skelp/verifier/CustomVerifierTestCaseBase.java
index f1bc676..aee8005 100644
--- a/src/test/java/io/skelp/verifier/CustomVerifierTestCaseBase.java
+++ b/src/test/java/io/skelp/verifier/CustomVerifierTestCaseBase.java
@@ -44,6 +44,8 @@
import io.skelp.verifier.verification.TestVerificationProvider;
import io.skelp.verifier.verification.Verification;
import io.skelp.verifier.verification.VerificationProvider;
+import io.skelp.verifier.verification.report.DefaultReportExecutorProvider;
+import io.skelp.verifier.verification.report.ReportExecutor;
/**
*
@@ -126,6 +128,8 @@ protected static Map createMap(K[] keys, V[] values) {
@Mock
private MessageSource mockMessageSource;
@Mock
+ private ReportExecutor mockReportExecutor;
+ @Mock
private Verification mockVerification;
@Mock
private VerificationProvider mockVerificationProvider;
@@ -136,12 +140,13 @@ protected static Map createMap(K[] keys, V[] values) {
@Before
public void setUp() throws Exception {
- when(mockVerificationProvider.getVerification(any(), any())).thenAnswer(invocation -> new SimpleVerification<>(new SimpleLocaleContext(), new ResourceBundleMessageSource(), invocation.getArguments()[0], invocation.getArguments()[1]));
+ when(mockVerificationProvider.getVerification(any(), any())).thenAnswer(invocation -> new SimpleVerification<>(new SimpleLocaleContext(), new ResourceBundleMessageSource(), new DefaultReportExecutorProvider().getReportExecutor(), invocation.getArguments()[0], invocation.getArguments()[1]));
TestVerificationProvider.setDelegate(mockVerificationProvider);
when(mockVerification.getLocaleContext()).thenReturn(mockLocaleContext);
when(mockVerification.getMessageSource()).thenReturn(mockMessageSource);
+ when(mockVerification.getReportExecutor()).thenReturn(mockReportExecutor);
when(mockVerification.getValue()).thenAnswer(invocation -> value);
value = null;
@@ -165,8 +170,7 @@ public void tearDown() throws Exception {
/**
*
- * Returns an argument captor to be be used to capture any varargs that are passed to {@link
- * Verification#check(boolean, String, Object...)}.
+ * Returns an argument captor to be be used to capture any varargs that are passed to {@link Verification#report}.
*
*
* @return An {@code ArgumentCaptor} to be used to capture optional format arguments.
@@ -208,6 +212,17 @@ protected MessageSource getMockMessageSource() {
return mockMessageSource;
}
+ /**
+ *
+ * Returns the mock report executor being used to test the subject.
+ *
+ *
+ * @return The mock {@link ReportExecutor}.
+ */
+ protected ReportExecutor getMockReportExecutor() {
+ return mockReportExecutor;
+ }
+
/**
*
* Returns the mock verification being used to test the subject.
diff --git a/src/test/java/io/skelp/verifier/DefaultCustomVerifierProviderTest.java b/src/test/java/io/skelp/verifier/DefaultCustomVerifierProviderTest.java
index 5b16ae5..e95bef6 100644
--- a/src/test/java/io/skelp/verifier/DefaultCustomVerifierProviderTest.java
+++ b/src/test/java/io/skelp/verifier/DefaultCustomVerifierProviderTest.java
@@ -39,6 +39,7 @@
import io.skelp.verifier.verification.TestVerificationProvider;
import io.skelp.verifier.verification.Verification;
import io.skelp.verifier.verification.VerificationProvider;
+import io.skelp.verifier.verification.report.DefaultReportExecutorProvider;
/**
*
@@ -59,7 +60,7 @@ public class DefaultCustomVerifierProviderTest {
@Before
public void setUp() {
- when(mockVerificationProvider.getVerification(any(), any())).thenAnswer(invocation -> new SimpleVerification<>(new SimpleLocaleContext(Locale.ENGLISH), new ResourceBundleMessageSource(), invocation.getArguments()[0], invocation.getArguments()[1]));
+ when(mockVerificationProvider.getVerification(any(), any())).thenAnswer(invocation -> new SimpleVerification<>(new SimpleLocaleContext(Locale.ENGLISH), new ResourceBundleMessageSource(), new DefaultReportExecutorProvider().getReportExecutor(), invocation.getArguments()[0], invocation.getArguments()[1]));
TestVerificationProvider.setDelegate(mockVerificationProvider);
diff --git a/src/test/java/io/skelp/verifier/message/AbstractMessageSourceTestCase.java b/src/test/java/io/skelp/verifier/message/AbstractMessageSourceTestCase.java
index 25ddfe8..f9af95e 100644
--- a/src/test/java/io/skelp/verifier/message/AbstractMessageSourceTestCase.java
+++ b/src/test/java/io/skelp/verifier/message/AbstractMessageSourceTestCase.java
@@ -400,7 +400,7 @@ public void testGetMessageWithMessageKeyWhenMessageNotFoundAndUseKeyAsDefaultMes
@Test(expected = NoSuchMessageException.class)
public void testGetMessageWithMessageKeyThrowsWhenMessageNotFound() throws Exception {
- messageSource.getMessage(mockVerification, (MessageKey) null);
+ messageSource.getMessage(mockVerification, getMissingMessageKey(), null);
}
private void testGetMessageWithMessageKeyHelper(MessageKey key, Object[] args, boolean useKeyAsDefaultMessage, boolean negated, String expected) {
diff --git a/src/test/java/io/skelp/verifier/type/BooleanVerifierTest.java b/src/test/java/io/skelp/verifier/type/BooleanVerifierTest.java
index 04c48e8..de9c4a2 100644
--- a/src/test/java/io/skelp/verifier/type/BooleanVerifierTest.java
+++ b/src/test/java/io/skelp/verifier/type/BooleanVerifierTest.java
@@ -88,7 +88,7 @@ private void testBetweenHelper(Boolean value) {
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().between(false, true));
- verify(getMockVerification()).check(eq(true), eq(BaseComparableVerifier.MessageKeys.BETWEEN), getArgsCaptor().capture());
+ verify(getMockVerification()).report(eq(true), eq(BaseComparableVerifier.MessageKeys.BETWEEN), getArgsCaptor().capture());
assertArrayEquals("Passes start and end for message formatting", new Object[]{false, true}, getArgsCaptor().getAllValues().toArray());
}
@@ -108,7 +108,7 @@ private void testBetweenExclusiveHelper(Boolean value) {
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().betweenExclusive(false, true));
- verify(getMockVerification()).check(eq(false), eq(BaseComparableVerifier.MessageKeys.BETWEEN_EXCLUSIVE), getArgsCaptor().capture());
+ verify(getMockVerification()).report(eq(false), eq(BaseComparableVerifier.MessageKeys.BETWEEN_EXCLUSIVE), getArgsCaptor().capture());
assertArrayEquals("Passes start and end for message formatting", new Object[]{false, true}, getArgsCaptor().getAllValues().toArray());
}
@@ -133,7 +133,7 @@ private void testLessThanHelper(Boolean value, Boolean other, boolean expected)
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().lessThan(other));
- verify(getMockVerification()).check(eq(expected), eq(BaseComparableVerifier.MessageKeys.LESS_THAN), getArgsCaptor().capture());
+ verify(getMockVerification()).report(eq(expected), eq(BaseComparableVerifier.MessageKeys.LESS_THAN), getArgsCaptor().capture());
assertSame("Passes other for message formatting", other, getArgsCaptor().getValue());
}
@@ -158,7 +158,7 @@ private void testLessThanOrEqualToHelper(Boolean value, Boolean other, boolean e
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().lessThanOrEqualTo(other));
- verify(getMockVerification()).check(eq(expected), eq(BaseComparableVerifier.MessageKeys.LESS_THAN_OR_EQUAL_TO), getArgsCaptor().capture());
+ verify(getMockVerification()).report(eq(expected), eq(BaseComparableVerifier.MessageKeys.LESS_THAN_OR_EQUAL_TO), getArgsCaptor().capture());
assertSame("Passes other for message formatting", other, getArgsCaptor().getValue());
}
@@ -183,7 +183,7 @@ private void testGreaterThanHelper(Boolean value, Boolean other, boolean expecte
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().greaterThan(other));
- verify(getMockVerification()).check(eq(expected), eq(BaseComparableVerifier.MessageKeys.GREATER_THAN), getArgsCaptor().capture());
+ verify(getMockVerification()).report(eq(expected), eq(BaseComparableVerifier.MessageKeys.GREATER_THAN), getArgsCaptor().capture());
assertSame("Passes other for message formatting", other, getArgsCaptor().getValue());
}
@@ -208,7 +208,7 @@ private void testGreaterThanOrEqualToHelper(Boolean value, Boolean other, boolea
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().greaterThanOrEqualTo(other));
- verify(getMockVerification()).check(eq(expected), eq(BaseComparableVerifier.MessageKeys.GREATER_THAN_OR_EQUAL_TO), getArgsCaptor().capture());
+ verify(getMockVerification()).report(eq(expected), eq(BaseComparableVerifier.MessageKeys.GREATER_THAN_OR_EQUAL_TO), getArgsCaptor().capture());
assertSame("Passes other for message formatting", other, getArgsCaptor().getValue());
}
diff --git a/src/test/java/io/skelp/verifier/type/CharacterVerifierTest.java b/src/test/java/io/skelp/verifier/type/CharacterVerifierTest.java
index e693c2c..ceb157d 100644
--- a/src/test/java/io/skelp/verifier/type/CharacterVerifierTest.java
+++ b/src/test/java/io/skelp/verifier/type/CharacterVerifierTest.java
@@ -212,7 +212,7 @@ private void testAlphaHelper(Character[] values, boolean expected) {
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().alpha());
}
- verify(getMockVerification(), times(values.length)).check(expected, CharacterVerifier.MessageKeys.ALPHA);
+ verify(getMockVerification(), times(values.length)).report(expected, CharacterVerifier.MessageKeys.ALPHA);
}
@Test
@@ -262,7 +262,7 @@ private void testAlphanumericHelper(Character[] values, boolean expected) {
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().alphanumeric());
}
- verify(getMockVerification(), times(values.length)).check(expected, CharacterVerifier.MessageKeys.ALPHANUMERIC);
+ verify(getMockVerification(), times(values.length)).report(expected, CharacterVerifier.MessageKeys.ALPHANUMERIC);
}
@Test
@@ -312,7 +312,7 @@ private void testAsciiHelper(Character[] values, boolean expected) {
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().ascii());
}
- verify(getMockVerification(), times(values.length)).check(expected, CharacterVerifier.MessageKeys.ASCII);
+ verify(getMockVerification(), times(values.length)).report(expected, CharacterVerifier.MessageKeys.ASCII);
}
@Test
@@ -362,7 +362,7 @@ private void testAsciiAlphaHelper(Character[] values, boolean expected) {
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().asciiAlpha());
}
- verify(getMockVerification(), times(values.length)).check(expected, CharacterVerifier.MessageKeys.ASCII_ALPHA);
+ verify(getMockVerification(), times(values.length)).report(expected, CharacterVerifier.MessageKeys.ASCII_ALPHA);
}
@Test
@@ -412,7 +412,7 @@ private void testAsciiAlphaLowerCaseHelper(Character[] values, boolean expected)
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().asciiAlphaLowerCase());
}
- verify(getMockVerification(), times(values.length)).check(expected, CharacterVerifier.MessageKeys.ASCII_ALPHA_LOWER_CASE);
+ verify(getMockVerification(), times(values.length)).report(expected, CharacterVerifier.MessageKeys.ASCII_ALPHA_LOWER_CASE);
}
@Test
@@ -462,7 +462,7 @@ private void testAsciiAlphaUpperCaseHelper(Character[] values, boolean expected)
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().asciiAlphaUpperCase());
}
- verify(getMockVerification(), times(values.length)).check(expected, CharacterVerifier.MessageKeys.ASCII_ALPHA_UPPER_CASE);
+ verify(getMockVerification(), times(values.length)).report(expected, CharacterVerifier.MessageKeys.ASCII_ALPHA_UPPER_CASE);
}
@Test
@@ -512,7 +512,7 @@ private void testAsciiAlphanumericHelper(Character[] values, boolean expected) {
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().asciiAlphanumeric());
}
- verify(getMockVerification(), times(values.length)).check(expected, CharacterVerifier.MessageKeys.ASCII_ALPHANUMERIC);
+ verify(getMockVerification(), times(values.length)).report(expected, CharacterVerifier.MessageKeys.ASCII_ALPHANUMERIC);
}
@Test
@@ -562,7 +562,7 @@ private void testAsciiControlHelper(Character[] values, boolean expected) {
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().asciiControl());
}
- verify(getMockVerification(), times(values.length)).check(expected, CharacterVerifier.MessageKeys.ASCII_CONTROL);
+ verify(getMockVerification(), times(values.length)).report(expected, CharacterVerifier.MessageKeys.ASCII_CONTROL);
}
@Test
@@ -612,7 +612,7 @@ private void testAsciiNumericHelper(Character[] values, boolean expected) {
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().asciiNumeric());
}
- verify(getMockVerification(), times(values.length)).check(expected, CharacterVerifier.MessageKeys.ASCII_NUMERIC);
+ verify(getMockVerification(), times(values.length)).report(expected, CharacterVerifier.MessageKeys.ASCII_NUMERIC);
}
@Test
@@ -667,7 +667,7 @@ private void testAsciiPrintableHelper(Character[] values, boolean expected) {
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().asciiPrintable());
}
- verify(getMockVerification(), times(values.length)).check(expected, CharacterVerifier.MessageKeys.ASCII_PRINTABLE);
+ verify(getMockVerification(), times(values.length)).report(expected, CharacterVerifier.MessageKeys.ASCII_PRINTABLE);
}
@Test
@@ -722,7 +722,7 @@ private void testLowerCaseHelper(Character[] values, boolean expected) {
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().lowerCase());
}
- verify(getMockVerification(), times(values.length)).check(expected, CharacterVerifier.MessageKeys.LOWER_CASE);
+ verify(getMockVerification(), times(values.length)).report(expected, CharacterVerifier.MessageKeys.LOWER_CASE);
}
@Test
@@ -777,7 +777,7 @@ private void testNumericHelper(Character[] values, boolean expected) {
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().numeric());
}
- verify(getMockVerification(), times(values.length)).check(expected, CharacterVerifier.MessageKeys.NUMERIC);
+ verify(getMockVerification(), times(values.length)).report(expected, CharacterVerifier.MessageKeys.NUMERIC);
}
@Test
@@ -832,7 +832,7 @@ private void testUpperCaseHelper(Character[] values, boolean expected) {
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().upperCase());
}
- verify(getMockVerification(), times(values.length)).check(expected, CharacterVerifier.MessageKeys.UPPER_CASE);
+ verify(getMockVerification(), times(values.length)).report(expected, CharacterVerifier.MessageKeys.UPPER_CASE);
}
@Test
@@ -882,7 +882,7 @@ private void testWhitespaceHelper(Character[] values, boolean expected) {
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().whitespace());
}
- verify(getMockVerification(), times(values.length)).check(expected, CharacterVerifier.MessageKeys.WHITESPACE);
+ verify(getMockVerification(), times(values.length)).report(expected, CharacterVerifier.MessageKeys.WHITESPACE);
}
@Override
diff --git a/src/test/java/io/skelp/verifier/type/ClassVerifierTest.java b/src/test/java/io/skelp/verifier/type/ClassVerifierTest.java
index 2e84d40..08b5acc 100644
--- a/src/test/java/io/skelp/verifier/type/ClassVerifierTest.java
+++ b/src/test/java/io/skelp/verifier/type/ClassVerifierTest.java
@@ -115,7 +115,7 @@ private void testAnnotatedHelper(Class> value, boolean expected) {
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().annotated());
- verify(getMockVerification()).check(expected, ClassVerifier.MessageKeys.ANNOTATED);
+ verify(getMockVerification()).report(expected, ClassVerifier.MessageKeys.ANNOTATED);
}
@Test
@@ -153,7 +153,7 @@ private void testAnnotatedWithHelper(Class> value, Class extends Annotation>
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().annotatedWith(type));
- verify(getMockVerification()).check(eq(expected), eq(ClassVerifier.MessageKeys.ANNOTATED_WITH), getArgsCaptor().capture());
+ verify(getMockVerification()).report(eq(expected), eq(ClassVerifier.MessageKeys.ANNOTATED_WITH), getArgsCaptor().capture());
assertSame("Passes type for message formatting", type, getArgsCaptor().getValue());
}
@@ -208,7 +208,7 @@ private void testAnnotatedWithAllHelper(Class> value, Class extends Annotati
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().annotatedWithAll(types));
- verify(getMockVerification()).check(expected, ClassVerifier.MessageKeys.ANNOTATED_WITH_ALL, (Object) types);
+ verify(getMockVerification()).report(expected, ClassVerifier.MessageKeys.ANNOTATED_WITH_ALL, (Object) types);
}
@Test
@@ -261,7 +261,7 @@ private void testAnnotatedWithAnyHelper(Class> value, Class extends Annotati
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().annotatedWithAny(types));
- verify(getMockVerification()).check(expected, ClassVerifier.MessageKeys.ANNOTATED_WITH_ANY, (Object) types);
+ verify(getMockVerification()).report(expected, ClassVerifier.MessageKeys.ANNOTATED_WITH_ANY, (Object) types);
}
@Test
@@ -284,7 +284,7 @@ private void testAnnotationHelper(Class> value, boolean expected) {
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().annotation());
- verify(getMockVerification()).check(expected, ClassVerifier.MessageKeys.ANNOTATION);
+ verify(getMockVerification()).report(expected, ClassVerifier.MessageKeys.ANNOTATION);
}
@Test
@@ -308,7 +308,7 @@ private void testAnonymousHelper(Class> value, boolean expected) {
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().anonymous());
- verify(getMockVerification()).check(expected, ClassVerifier.MessageKeys.ANONYMOUS);
+ verify(getMockVerification()).report(expected, ClassVerifier.MessageKeys.ANONYMOUS);
}
@Test
@@ -331,7 +331,7 @@ private void testArrayHelper(Class> value, boolean expected) {
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().array());
- verify(getMockVerification()).check(expected, ClassVerifier.MessageKeys.ARRAY);
+ verify(getMockVerification()).report(expected, ClassVerifier.MessageKeys.ARRAY);
}
@Test
@@ -364,7 +364,7 @@ private void testAssignableFromHelper(Class> value, Class> type, boolean exp
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().assignableFrom(type));
- verify(getMockVerification()).check(eq(expected), eq(ClassVerifier.MessageKeys.ASSIGNABLE_FROM), getArgsCaptor().capture());
+ verify(getMockVerification()).report(eq(expected), eq(ClassVerifier.MessageKeys.ASSIGNABLE_FROM), getArgsCaptor().capture());
assertSame("Passes type for message formatting", type, getArgsCaptor().getValue());
}
@@ -389,7 +389,7 @@ private void testEnumerationHelper(Class> value, boolean expected) {
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().enumeration());
- verify(getMockVerification()).check(expected, ClassVerifier.MessageKeys.ENUMERATION);
+ verify(getMockVerification()).report(expected, ClassVerifier.MessageKeys.ENUMERATION);
}
@Test
@@ -412,7 +412,7 @@ private void testInterfacingHelper(Class> value, boolean expected) {
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().interfacing());
- verify(getMockVerification()).check(expected, ClassVerifier.MessageKeys.INTERFACING);
+ verify(getMockVerification()).report(expected, ClassVerifier.MessageKeys.INTERFACING);
}
@Test
@@ -435,7 +435,7 @@ private void testNestedHelper(Class> value, boolean expected) {
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().nested());
- verify(getMockVerification()).check(expected, ClassVerifier.MessageKeys.NESTED);
+ verify(getMockVerification()).report(expected, ClassVerifier.MessageKeys.NESTED);
}
@Test
@@ -468,7 +468,7 @@ private void testPrimitiveHelper(Class>[] values, boolean expected) {
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().primitive());
}
- verify(getMockVerification(), times(values.length)).check(expected, ClassVerifier.MessageKeys.PRIMITIVE);
+ verify(getMockVerification(), times(values.length)).report(expected, ClassVerifier.MessageKeys.PRIMITIVE);
}
@Test
@@ -498,7 +498,7 @@ private void testPrimitiveOrWrapperHelper(Class>[] values, boolean expected) {
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().primitiveOrWrapper());
}
- verify(getMockVerification(), times(values.length)).check(expected, ClassVerifier.MessageKeys.PRIMITIVE_OR_WRAPPER);
+ verify(getMockVerification(), times(values.length)).report(expected, ClassVerifier.MessageKeys.PRIMITIVE_OR_WRAPPER);
}
@Test
@@ -531,7 +531,7 @@ private void testPrimitiveWrapperHelper(Class>[] values, boolean expected) {
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().primitiveWrapper());
}
- verify(getMockVerification(), times(values.length)).check(expected, ClassVerifier.MessageKeys.PRIMITIVE_WRAPPER);
+ verify(getMockVerification(), times(values.length)).report(expected, ClassVerifier.MessageKeys.PRIMITIVE_WRAPPER);
}
}
diff --git a/src/test/java/io/skelp/verifier/type/LocaleVerifierTest.java b/src/test/java/io/skelp/verifier/type/LocaleVerifierTest.java
index 4c6bb9f..c1bea7b 100644
--- a/src/test/java/io/skelp/verifier/type/LocaleVerifierTest.java
+++ b/src/test/java/io/skelp/verifier/type/LocaleVerifierTest.java
@@ -162,7 +162,7 @@ private void testAvailableHelper(Locale value, Locale[] availableLocales, boolea
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().available());
- verify(getMockVerification()).check(expected, LocaleVerifier.MessageKeys.AVAILABLE);
+ verify(getMockVerification()).report(expected, LocaleVerifier.MessageKeys.AVAILABLE);
}
@Test
@@ -186,7 +186,7 @@ private void testDefaultingHelper(Locale value, Locale defaultLocale, boolean ex
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().defaulting());
- verify(getMockVerification()).check(expected, LocaleVerifier.MessageKeys.DEFAULTING);
+ verify(getMockVerification()).report(expected, LocaleVerifier.MessageKeys.DEFAULTING);
}
@Test
@@ -209,7 +209,7 @@ private void testCountryHelper(Locale value, String country, boolean expected) {
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().country(country));
- verify(getMockVerification()).check(eq(expected), eq(LocaleVerifier.MessageKeys.COUNTRY), getArgsCaptor().capture());
+ verify(getMockVerification()).report(eq(expected), eq(LocaleVerifier.MessageKeys.COUNTRY), getArgsCaptor().capture());
assertSame("Passes country for message formatting", country, getArgsCaptor().getValue());
}
@@ -234,7 +234,7 @@ private void testLanguageHelper(Locale value, String language, boolean expected)
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().language(language));
- verify(getMockVerification()).check(eq(expected), eq(LocaleVerifier.MessageKeys.LANGUAGE), getArgsCaptor().capture());
+ verify(getMockVerification()).report(eq(expected), eq(LocaleVerifier.MessageKeys.LANGUAGE), getArgsCaptor().capture());
assertSame("Passes language for message formatting", language, getArgsCaptor().getValue());
}
@@ -263,7 +263,7 @@ private void testScriptHelper(Locale value, String script, boolean expected) {
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().script(script));
- verify(getMockVerification()).check(eq(expected), eq(LocaleVerifier.MessageKeys.SCRIPT), getArgsCaptor().capture());
+ verify(getMockVerification()).report(eq(expected), eq(LocaleVerifier.MessageKeys.SCRIPT), getArgsCaptor().capture());
assertSame("Passes script for message formatting", script, getArgsCaptor().getValue());
}
@@ -288,7 +288,7 @@ private void testVariantHelper(Locale value, String variant, boolean expected) {
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().variant(variant));
- verify(getMockVerification()).check(eq(expected), eq(LocaleVerifier.MessageKeys.VARIANT), getArgsCaptor().capture());
+ verify(getMockVerification()).report(eq(expected), eq(LocaleVerifier.MessageKeys.VARIANT), getArgsCaptor().capture());
assertSame("Passes variant for message formatting", variant, getArgsCaptor().getValue());
}
diff --git a/src/test/java/io/skelp/verifier/type/MapVerifierTest.java b/src/test/java/io/skelp/verifier/type/MapVerifierTest.java
index a4fbd2b..c2a4a7a 100644
--- a/src/test/java/io/skelp/verifier/type/MapVerifierTest.java
+++ b/src/test/java/io/skelp/verifier/type/MapVerifierTest.java
@@ -176,7 +176,7 @@ private void testContainAllKeysHelper(Map value, String[] keys,
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().containAllKeys(keys));
- verify(getMockVerification()).check(expected, MapVerifier.MessageKeys.CONTAIN_ALL_KEYS, (Object) keys);
+ verify(getMockVerification()).report(expected, MapVerifier.MessageKeys.CONTAIN_ALL_KEYS, (Object) keys);
}
@Test
@@ -229,7 +229,7 @@ private void testContainAnyKeyHelper(Map value, String[] keys,
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().containAnyKey(keys));
- verify(getMockVerification()).check(expected, MapVerifier.MessageKeys.CONTAIN_ANY_KEY, (Object) keys);
+ verify(getMockVerification()).report(expected, MapVerifier.MessageKeys.CONTAIN_ANY_KEY, (Object) keys);
}
@Test
@@ -259,7 +259,7 @@ private void testContainKeyHelper(Map value, String key, boolea
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().containKey(key));
- verify(getMockVerification()).check(eq(expected), eq(MapVerifier.MessageKeys.CONTAIN_KEY), getArgsCaptor().capture());
+ verify(getMockVerification()).report(eq(expected), eq(MapVerifier.MessageKeys.CONTAIN_KEY), getArgsCaptor().capture());
assertSame("Passes key for message formatting", key, getArgsCaptor().getValue());
}
diff --git a/src/test/java/io/skelp/verifier/type/StringVerifierTest.java b/src/test/java/io/skelp/verifier/type/StringVerifierTest.java
index ef7d26a..423d242 100644
--- a/src/test/java/io/skelp/verifier/type/StringVerifierTest.java
+++ b/src/test/java/io/skelp/verifier/type/StringVerifierTest.java
@@ -196,7 +196,7 @@ private void testAlphaHelper(String value, boolean expected) {
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().alpha());
- verify(getMockVerification()).check(expected, StringVerifier.MessageKeys.ALPHA);
+ verify(getMockVerification()).report(expected, StringVerifier.MessageKeys.ALPHA);
}
@Test
@@ -244,7 +244,7 @@ private void testAlphaSpaceHelper(String value, boolean expected) {
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().alphaSpace());
- verify(getMockVerification()).check(expected, StringVerifier.MessageKeys.ALPHA_SPACE);
+ verify(getMockVerification()).report(expected, StringVerifier.MessageKeys.ALPHA_SPACE);
}
@Test
@@ -302,7 +302,7 @@ private void testAlphanumericHelper(String value, boolean expected) {
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().alphanumeric());
- verify(getMockVerification()).check(expected, StringVerifier.MessageKeys.ALPHANUMERIC);
+ verify(getMockVerification()).report(expected, StringVerifier.MessageKeys.ALPHANUMERIC);
}
@Test
@@ -360,7 +360,7 @@ private void testAlphanumericSpaceHelper(String value, boolean expected) {
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().alphanumericSpace());
- verify(getMockVerification()).check(expected, StringVerifier.MessageKeys.ALPHANUMERIC_SPACE);
+ verify(getMockVerification()).report(expected, StringVerifier.MessageKeys.ALPHANUMERIC_SPACE);
}
@Test
@@ -398,7 +398,7 @@ private void testAsciiPrintableHelper(String value, boolean expected) {
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().asciiPrintable());
- verify(getMockVerification()).check(expected, StringVerifier.MessageKeys.ASCII_PRINTABLE);
+ verify(getMockVerification()).report(expected, StringVerifier.MessageKeys.ASCII_PRINTABLE);
}
@Test
@@ -426,7 +426,7 @@ private void testBlankHelper(String value, boolean expected) {
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().blank());
- verify(getMockVerification()).check(expected, StringVerifier.MessageKeys.BLANK);
+ verify(getMockVerification()).report(expected, StringVerifier.MessageKeys.BLANK);
}
@Test
@@ -494,7 +494,7 @@ private void testContainHelper(String value, CharSequence other, boolean expecte
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().contain(other));
- verify(getMockVerification()).check(eq(expected), eq(StringVerifier.MessageKeys.CONTAIN), getArgsCaptor().capture());
+ verify(getMockVerification()).report(eq(expected), eq(StringVerifier.MessageKeys.CONTAIN), getArgsCaptor().capture());
assertSame("Passes other for message formatting", other, getArgsCaptor().getValue());
}
@@ -594,7 +594,7 @@ private void testContainAllHelper(String value, CharSequence[] others, boolean e
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().containAll(others));
- verify(getMockVerification()).check(expected, StringVerifier.MessageKeys.CONTAIN_ALL, (Object) others);
+ verify(getMockVerification()).report(expected, StringVerifier.MessageKeys.CONTAIN_ALL, (Object) others);
}
@Test
@@ -692,7 +692,7 @@ private void testContainAllIgnoreCaseHelper(String value, CharSequence[] others,
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().containAllIgnoreCase(others));
- verify(getMockVerification()).check(expected, StringVerifier.MessageKeys.CONTAIN_ALL_IGNORE_CASE, (Object) others);
+ verify(getMockVerification()).report(expected, StringVerifier.MessageKeys.CONTAIN_ALL_IGNORE_CASE, (Object) others);
}
@Test
@@ -770,7 +770,7 @@ private void testContainAnyHelper(String value, CharSequence[] others, boolean e
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().containAny(others));
- verify(getMockVerification()).check(expected, StringVerifier.MessageKeys.CONTAIN_ANY, (Object) others);
+ verify(getMockVerification()).report(expected, StringVerifier.MessageKeys.CONTAIN_ANY, (Object) others);
}
@Test
@@ -848,7 +848,7 @@ private void testContainAnyIgnoreCaseHelper(String value, CharSequence[] others,
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().containAnyIgnoreCase(others));
- verify(getMockVerification()).check(expected, StringVerifier.MessageKeys.CONTAIN_ANY_IGNORE_CASE, (Object) others);
+ verify(getMockVerification()).report(expected, StringVerifier.MessageKeys.CONTAIN_ANY_IGNORE_CASE, (Object) others);
}
@Test
@@ -936,7 +936,7 @@ private void testContainIgnoreCaseHelper(String value, CharSequence other, boole
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().containIgnoreCase(other));
- verify(getMockVerification()).check(eq(expected), eq(StringVerifier.MessageKeys.CONTAIN_IGNORE_CASE), getArgsCaptor().capture());
+ verify(getMockVerification()).report(eq(expected), eq(StringVerifier.MessageKeys.CONTAIN_IGNORE_CASE), getArgsCaptor().capture());
assertSame("Passes other for message formatting", other, getArgsCaptor().getValue());
}
@@ -966,7 +966,7 @@ private void testEmptyHelper(String value, boolean expected) {
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().empty());
- verify(getMockVerification()).check(expected, StringVerifier.MessageKeys.EMPTY);
+ verify(getMockVerification()).report(expected, StringVerifier.MessageKeys.EMPTY);
}
@Test
@@ -1039,7 +1039,7 @@ private void testEndWithHelper(String value, CharSequence other, boolean expecte
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().endWith(other));
- verify(getMockVerification()).check(eq(expected), eq(StringVerifier.MessageKeys.END_WITH), getArgsCaptor().capture());
+ verify(getMockVerification()).report(eq(expected), eq(StringVerifier.MessageKeys.END_WITH), getArgsCaptor().capture());
assertSame("Passes other for message formatting", other, getArgsCaptor().getValue());
}
@@ -1124,7 +1124,7 @@ private void testEndWithAnyHelper(String value, CharSequence[] others, boolean e
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().endWithAny(others));
- verify(getMockVerification()).check(expected, StringVerifier.MessageKeys.END_WITH_ANY, (Object) others);
+ verify(getMockVerification()).report(expected, StringVerifier.MessageKeys.END_WITH_ANY, (Object) others);
}
@Test
@@ -1207,7 +1207,7 @@ private void testEndWithAnyIgnoreCaseHelper(String value, CharSequence[] others,
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().endWithAnyIgnoreCase(others));
- verify(getMockVerification()).check(expected, StringVerifier.MessageKeys.END_WITH_ANY_IGNORE_CASE, (Object) others);
+ verify(getMockVerification()).report(expected, StringVerifier.MessageKeys.END_WITH_ANY_IGNORE_CASE, (Object) others);
}
@Test
@@ -1280,7 +1280,7 @@ private void testEndWithIgnoreCaseHelper(String value, CharSequence other, boole
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().endWithIgnoreCase(other));
- verify(getMockVerification()).check(eq(expected), eq(StringVerifier.MessageKeys.END_WITH_IGNORE_CASE), getArgsCaptor().capture());
+ verify(getMockVerification()).report(eq(expected), eq(StringVerifier.MessageKeys.END_WITH_IGNORE_CASE), getArgsCaptor().capture());
assertSame("Passes other for message formatting", other, getArgsCaptor().getValue());
}
@@ -1362,7 +1362,7 @@ private void testEqualToAnyIgnoreCaseHelper(String value, CharSequence[] others,
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().equalToAnyIgnoreCase(others));
- verify(getMockVerification()).check(expected, StringVerifier.MessageKeys.EQUAL_TO_ANY_IGNORE_CASE, (Object) others);
+ verify(getMockVerification()).report(expected, StringVerifier.MessageKeys.EQUAL_TO_ANY_IGNORE_CASE, (Object) others);
}
@Test
@@ -1432,7 +1432,7 @@ private void testEqualToIgnoreCaseHelper(String value, CharSequence other, boole
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().equalToIgnoreCase(other));
- verify(getMockVerification()).check(eq(expected), eq(StringVerifier.MessageKeys.EQUAL_TO_IGNORE_CASE), getArgsCaptor().capture());
+ verify(getMockVerification()).report(eq(expected), eq(StringVerifier.MessageKeys.EQUAL_TO_IGNORE_CASE), getArgsCaptor().capture());
assertSame("Passes other for message formatting", other, getArgsCaptor().getValue());
}
@@ -1482,7 +1482,7 @@ private void testLowerCaseHelper(String value, boolean expected) {
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().lowerCase());
- verify(getMockVerification()).check(expected, StringVerifier.MessageKeys.LOWER_CASE);
+ verify(getMockVerification()).report(expected, StringVerifier.MessageKeys.LOWER_CASE);
}
@Test
@@ -1530,7 +1530,7 @@ private void testMatchHelper(String value, CharSequence regex, boolean expected)
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().match(regex));
- verify(getMockVerification()).check(eq(expected), eq(StringVerifier.MessageKeys.MATCH), getArgsCaptor().capture());
+ verify(getMockVerification()).report(eq(expected), eq(StringVerifier.MessageKeys.MATCH), getArgsCaptor().capture());
assertSame("Passes regex for message formatting", regex, getArgsCaptor().getValue());
}
@@ -1570,7 +1570,7 @@ private void testMatchWithPatternHelper(String value, Pattern pattern, boolean e
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().match(pattern));
- verify(getMockVerification()).check(eq(expected), eq(StringVerifier.MessageKeys.MATCH), getArgsCaptor().capture());
+ verify(getMockVerification()).report(eq(expected), eq(StringVerifier.MessageKeys.MATCH), getArgsCaptor().capture());
assertSame("Passes pattern for message formatting", pattern, getArgsCaptor().getValue());
}
@@ -1620,7 +1620,7 @@ private void testNumericHelper(String value, boolean expected) {
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().numeric());
- verify(getMockVerification()).check(expected, StringVerifier.MessageKeys.NUMERIC);
+ verify(getMockVerification()).report(expected, StringVerifier.MessageKeys.NUMERIC);
}
@Test
@@ -1668,7 +1668,7 @@ private void testNumericSpaceHelper(String value, boolean expected) {
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().numericSpace());
- verify(getMockVerification()).check(expected, StringVerifier.MessageKeys.NUMERIC_SPACE);
+ verify(getMockVerification()).report(expected, StringVerifier.MessageKeys.NUMERIC_SPACE);
}
@Test
@@ -1706,7 +1706,7 @@ private void testSizeOfHelper(String value, int size, boolean expected) {
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().sizeOf(size));
- verify(getMockVerification()).check(eq(expected), eq(StringVerifier.MessageKeys.SIZE_OF), getArgsCaptor().capture());
+ verify(getMockVerification()).report(eq(expected), eq(StringVerifier.MessageKeys.SIZE_OF), getArgsCaptor().capture());
assertSame("Passes size for message formatting", size, getArgsCaptor().getValue());
}
@@ -1781,7 +1781,7 @@ private void testStartWithHelper(String value, CharSequence other, boolean expec
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().startWith(other));
- verify(getMockVerification()).check(eq(expected), eq(StringVerifier.MessageKeys.START_WITH), getArgsCaptor().capture());
+ verify(getMockVerification()).report(eq(expected), eq(StringVerifier.MessageKeys.START_WITH), getArgsCaptor().capture());
assertSame("Passes other for message formatting", other, getArgsCaptor().getValue());
}
@@ -1866,7 +1866,7 @@ private void testStartWithAnyHelper(String value, CharSequence[] others, boolean
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().startWithAny(others));
- verify(getMockVerification()).check(expected, StringVerifier.MessageKeys.START_WITH_ANY, (Object) others);
+ verify(getMockVerification()).report(expected, StringVerifier.MessageKeys.START_WITH_ANY, (Object) others);
}
@Test
@@ -1949,7 +1949,7 @@ private void testStartWithAnyIgnoreCaseHelper(String value, CharSequence[] other
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().startWithAnyIgnoreCase(others));
- verify(getMockVerification()).check(expected, StringVerifier.MessageKeys.START_WITH_ANY_IGNORE_CASE, (Object) others);
+ verify(getMockVerification()).report(expected, StringVerifier.MessageKeys.START_WITH_ANY_IGNORE_CASE, (Object) others);
}
@Test
@@ -2022,7 +2022,7 @@ private void testStartWithIgnoreCaseHelper(String value, CharSequence other, boo
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().startWithIgnoreCase(other));
- verify(getMockVerification()).check(eq(expected), eq(StringVerifier.MessageKeys.START_WITH_IGNORE_CASE), getArgsCaptor().capture());
+ verify(getMockVerification()).report(eq(expected), eq(StringVerifier.MessageKeys.START_WITH_IGNORE_CASE), getArgsCaptor().capture());
assertSame("Passes other for message formatting", other, getArgsCaptor().getValue());
}
@@ -2072,7 +2072,7 @@ private void testUpperCaseHelper(String value, boolean expected) {
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().upperCase());
- verify(getMockVerification()).check(expected, StringVerifier.MessageKeys.UPPER_CASE);
+ verify(getMockVerification()).report(expected, StringVerifier.MessageKeys.UPPER_CASE);
}
@Override
diff --git a/src/test/java/io/skelp/verifier/type/ThrowableVerifierTest.java b/src/test/java/io/skelp/verifier/type/ThrowableVerifierTest.java
index 4a71fd5..b01feaf 100644
--- a/src/test/java/io/skelp/verifier/type/ThrowableVerifierTest.java
+++ b/src/test/java/io/skelp/verifier/type/ThrowableVerifierTest.java
@@ -109,7 +109,7 @@ private void testCausedByHelper(Throwable value, Class> type, boolean expected
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().causedBy(type));
- verify(getMockVerification()).check(eq(expected), eq(ThrowableVerifier.MessageKeys.CAUSED_BY), getArgsCaptor().capture());
+ verify(getMockVerification()).report(eq(expected), eq(ThrowableVerifier.MessageKeys.CAUSED_BY), getArgsCaptor().capture());
assertSame("Passes type for message formatting", type, getArgsCaptor().getValue());
}
@@ -155,7 +155,7 @@ private void testCausedByHelper(Throwable value, Throwable cause, boolean expect
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().causedBy(cause));
- verify(getMockVerification()).check(eq(expected), eq(ThrowableVerifier.MessageKeys.CAUSED_BY), getArgsCaptor().capture());
+ verify(getMockVerification()).report(eq(expected), eq(ThrowableVerifier.MessageKeys.CAUSED_BY), getArgsCaptor().capture());
assertSame("Passes cause for message formatting", cause, getArgsCaptor().getValue());
}
@@ -201,7 +201,7 @@ private void testCausedByHelper(Throwable value, Throwable cause, Object name, b
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().causedBy(cause, name));
- verify(getMockVerification()).check(eq(expected), eq(ThrowableVerifier.MessageKeys.CAUSED_BY), getArgsCaptor().capture());
+ verify(getMockVerification()).report(eq(expected), eq(ThrowableVerifier.MessageKeys.CAUSED_BY), getArgsCaptor().capture());
assertSame("Passes name for message formatting", name, getArgsCaptor().getValue());
}
@@ -226,7 +226,7 @@ private void testCheckedHelper(Throwable value, boolean expected) {
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().checked());
- verify(getMockVerification()).check(expected, ThrowableVerifier.MessageKeys.CHECKED);
+ verify(getMockVerification()).report(expected, ThrowableVerifier.MessageKeys.CHECKED);
}
@Test
@@ -259,7 +259,7 @@ private void testMessageHelper(Throwable value, String message, boolean expected
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().message(message));
- verify(getMockVerification()).check(eq(expected), eq(ThrowableVerifier.MessageKeys.MESSAGE), getArgsCaptor().capture());
+ verify(getMockVerification()).report(eq(expected), eq(ThrowableVerifier.MessageKeys.MESSAGE), getArgsCaptor().capture());
assertSame("Passes message for message formatting", message, getArgsCaptor().getValue());
}
@@ -284,7 +284,7 @@ private void testUncheckedHelper(Throwable value, boolean expected) {
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().unchecked());
- verify(getMockVerification()).check(expected, ThrowableVerifier.MessageKeys.UNCHECKED);
+ verify(getMockVerification()).report(expected, ThrowableVerifier.MessageKeys.UNCHECKED);
}
@Override
diff --git a/src/test/java/io/skelp/verifier/type/base/BaseCollectionVerifierTestCase.java b/src/test/java/io/skelp/verifier/type/base/BaseCollectionVerifierTestCase.java
index e2f84e6..37051ae 100644
--- a/src/test/java/io/skelp/verifier/type/base/BaseCollectionVerifierTestCase.java
+++ b/src/test/java/io/skelp/verifier/type/base/BaseCollectionVerifierTestCase.java
@@ -79,7 +79,7 @@ private void testContainHelper(T value, E element, boolean expected) {
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().contain(element));
- verify(getMockVerification()).check(eq(expected), eq(BaseCollectionVerifier.MessageKeys.CONTAIN), getArgsCaptor().capture());
+ verify(getMockVerification()).report(eq(expected), eq(BaseCollectionVerifier.MessageKeys.CONTAIN), getArgsCaptor().capture());
assertSame("Passes element for message formatting", element, getArgsCaptor().getValue());
}
@@ -134,7 +134,7 @@ private void testContainAllHelper(T value, E[] elements, boolean expected) {
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().containAll(elements));
- verify(getMockVerification()).check(expected, BaseCollectionVerifier.MessageKeys.CONTAIN_ALL, (Object) elements);
+ verify(getMockVerification()).report(expected, BaseCollectionVerifier.MessageKeys.CONTAIN_ALL, (Object) elements);
}
@Test
@@ -187,7 +187,7 @@ private void testContainAnyHelper(T value, E[] elements, boolean expected) {
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().containAny(elements));
- verify(getMockVerification()).check(expected, BaseCollectionVerifier.MessageKeys.CONTAIN_ANY, (Object) elements);
+ verify(getMockVerification()).report(expected, BaseCollectionVerifier.MessageKeys.CONTAIN_ANY, (Object) elements);
}
@Test
@@ -210,7 +210,7 @@ private void testEmptyHelper(T value, boolean expected) {
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().empty());
- verify(getMockVerification()).check(expected, BaseCollectionVerifier.MessageKeys.EMPTY);
+ verify(getMockVerification()).report(expected, BaseCollectionVerifier.MessageKeys.EMPTY);
}
@Test
@@ -248,7 +248,7 @@ private void testSizeOfHelper(T value, int size, boolean expected) {
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().sizeOf(size));
- verify(getMockVerification()).check(eq(expected), eq(BaseCollectionVerifier.MessageKeys.SIZE_OF), getArgsCaptor().capture());
+ verify(getMockVerification()).report(eq(expected), eq(BaseCollectionVerifier.MessageKeys.SIZE_OF), getArgsCaptor().capture());
assertSame("Passes size for message formatting", size, getArgsCaptor().getValue());
}
@@ -298,7 +298,7 @@ private void testThatAllHelper(T value, int assertionCalls, boolean expected) {
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().thatAll(mockAssertion));
- verify(getMockVerification()).check(expected, (String) null);
+ verify(getMockVerification()).report(expected, (String) null);
verify(mockAssertion, times(assertionCalls)).verify(any(getElementClass()));
}
@@ -347,8 +347,8 @@ private void testThatAllInternalHelper(T value, int assertionCalls, boolean expe
assertEquals("Matches elements correctly", expected, getCustomVerifier().thatAllInternal(mockAssertion));
- verify(getMockVerification(), never()).check(anyBoolean(), any(MessageKey.class), anyVararg());
- verify(getMockVerification(), never()).check(anyBoolean(), any(String.class), anyVararg());
+ verify(getMockVerification(), never()).report(anyBoolean(), any(MessageKey.class), anyVararg());
+ verify(getMockVerification(), never()).report(anyBoolean(), any(String.class), anyVararg());
verify(mockAssertion, times(assertionCalls)).verify(any(getElementClass()));
}
@@ -397,7 +397,7 @@ private void testThatAllHelper(T value, int assertionCalls, boolean expected, St
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().thatAll(mockAssertion, message, args));
- verify(getMockVerification()).check(eq(expected), eq(message), getArgsCaptor().capture());
+ verify(getMockVerification()).report(eq(expected), eq(message), getArgsCaptor().capture());
verify(mockAssertion, times(assertionCalls)).verify(any(getElementClass()));
assertEquals("Passes args for message formatting", Arrays.asList(args), getArgsCaptor().getAllValues());
@@ -448,7 +448,7 @@ private void testThatAllHelper(T value, int assertionCalls, boolean expected, Me
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().thatAll(mockAssertion, key, args));
- verify(getMockVerification()).check(eq(expected), eq(key), getArgsCaptor().capture());
+ verify(getMockVerification()).report(eq(expected), eq(key), getArgsCaptor().capture());
verify(mockAssertion, times(assertionCalls)).verify(any(getElementClass()));
assertEquals("Passes args for message formatting", Arrays.asList(args), getArgsCaptor().getAllValues());
@@ -499,7 +499,7 @@ private void testThatAnyHelper(T value, int assertionCalls, boolean expected) {
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().thatAny(mockAssertion));
- verify(getMockVerification()).check(expected, (String) null);
+ verify(getMockVerification()).report(expected, (String) null);
verify(mockAssertion, times(assertionCalls)).verify(any(getElementClass()));
}
@@ -548,8 +548,8 @@ private void testThatAnyInternalHelper(T value, int assertionCalls, boolean expe
assertEquals("Matches elements correctly", expected, getCustomVerifier().thatAnyInternal(mockAssertion));
- verify(getMockVerification(), never()).check(anyBoolean(), any(MessageKey.class), anyVararg());
- verify(getMockVerification(), never()).check(anyBoolean(), any(String.class), anyVararg());
+ verify(getMockVerification(), never()).report(anyBoolean(), any(MessageKey.class), anyVararg());
+ verify(getMockVerification(), never()).report(anyBoolean(), any(String.class), anyVararg());
verify(mockAssertion, times(assertionCalls)).verify(any(getElementClass()));
}
@@ -598,7 +598,7 @@ private void testThatAnyHelper(T value, int assertionCalls, boolean expected, St
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().thatAny(mockAssertion, message, args));
- verify(getMockVerification()).check(eq(expected), eq(message), getArgsCaptor().capture());
+ verify(getMockVerification()).report(eq(expected), eq(message), getArgsCaptor().capture());
verify(mockAssertion, times(assertionCalls)).verify(any(getElementClass()));
assertEquals("Passes args for message formatting", Arrays.asList(args), getArgsCaptor().getAllValues());
@@ -649,7 +649,7 @@ private void testThatAnyHelper(T value, int assertionCalls, boolean expected, Me
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().thatAny(mockAssertion, key, args));
- verify(getMockVerification()).check(eq(expected), eq(key), getArgsCaptor().capture());
+ verify(getMockVerification()).report(eq(expected), eq(key), getArgsCaptor().capture());
verify(mockAssertion, times(assertionCalls)).verify(any(getElementClass()));
assertEquals("Passes args for message formatting", Arrays.asList(args), getArgsCaptor().getAllValues());
diff --git a/src/test/java/io/skelp/verifier/type/base/BaseComparableVerifierTestCase.java b/src/test/java/io/skelp/verifier/type/base/BaseComparableVerifierTestCase.java
index 8dea6f8..6bc0a9c 100644
--- a/src/test/java/io/skelp/verifier/type/base/BaseComparableVerifierTestCase.java
+++ b/src/test/java/io/skelp/verifier/type/base/BaseComparableVerifierTestCase.java
@@ -98,7 +98,7 @@ private void testBetweenHelper(T value, T start, T end, boolean expected) {
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().between(start, end));
- verify(getMockVerification()).check(eq(expected), eq(BaseComparableVerifier.MessageKeys.BETWEEN), getArgsCaptor().capture());
+ verify(getMockVerification()).report(eq(expected), eq(BaseComparableVerifier.MessageKeys.BETWEEN), getArgsCaptor().capture());
assertArrayEquals("Passes start and end for message formatting", new Object[]{start, end}, getArgsCaptor().getAllValues().toArray());
}
@@ -153,7 +153,7 @@ private void testBetweenHelper(T value, T start, T end, Object startName, Object
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().between(start, end, startName, endName));
- verify(getMockVerification()).check(eq(expected), eq(BaseComparableVerifier.MessageKeys.BETWEEN), getArgsCaptor().capture());
+ verify(getMockVerification()).report(eq(expected), eq(BaseComparableVerifier.MessageKeys.BETWEEN), getArgsCaptor().capture());
assertArrayEquals("Passes start and end names for message formatting", new Object[]{startName, endName}, getArgsCaptor().getAllValues().toArray());
}
@@ -208,7 +208,7 @@ private void testBetweenExclusiveHelper(T value, T start, T end, boolean expecte
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().betweenExclusive(start, end));
- verify(getMockVerification()).check(eq(expected), eq(BaseComparableVerifier.MessageKeys.BETWEEN_EXCLUSIVE), getArgsCaptor().capture());
+ verify(getMockVerification()).report(eq(expected), eq(BaseComparableVerifier.MessageKeys.BETWEEN_EXCLUSIVE), getArgsCaptor().capture());
assertArrayEquals("Passes start and end for message formatting", new Object[]{start, end}, getArgsCaptor().getAllValues().toArray());
}
@@ -263,7 +263,7 @@ private void testBetweenExclusiveHelper(T value, T start, T end, Object startNam
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().betweenExclusive(start, end, startName, endName));
- verify(getMockVerification()).check(eq(expected), eq(BaseComparableVerifier.MessageKeys.BETWEEN_EXCLUSIVE), getArgsCaptor().capture());
+ verify(getMockVerification()).report(eq(expected), eq(BaseComparableVerifier.MessageKeys.BETWEEN_EXCLUSIVE), getArgsCaptor().capture());
assertArrayEquals("Passes start and end names for message formatting", new Object[]{startName, endName}, getArgsCaptor().getAllValues().toArray());
}
@@ -303,7 +303,7 @@ private void testGreaterThanHelper(T value, T other, boolean expected) {
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().greaterThan(other));
- verify(getMockVerification()).check(eq(expected), eq(BaseComparableVerifier.MessageKeys.GREATER_THAN), getArgsCaptor().capture());
+ verify(getMockVerification()).report(eq(expected), eq(BaseComparableVerifier.MessageKeys.GREATER_THAN), getArgsCaptor().capture());
assertSame("Passes other for message formatting", other, getArgsCaptor().getValue());
}
@@ -343,7 +343,7 @@ private void testGreaterThanHelper(T value, T other, Object otherName, boolean e
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().greaterThan(other, otherName));
- verify(getMockVerification()).check(eq(expected), eq(BaseComparableVerifier.MessageKeys.GREATER_THAN), getArgsCaptor().capture());
+ verify(getMockVerification()).report(eq(expected), eq(BaseComparableVerifier.MessageKeys.GREATER_THAN), getArgsCaptor().capture());
assertSame("Passes other name for message formatting", otherName, getArgsCaptor().getValue());
}
@@ -383,7 +383,7 @@ private void testGreaterThanOrEqualToHelper(T value, T other, boolean expected)
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().greaterThanOrEqualTo(other));
- verify(getMockVerification()).check(eq(expected), eq(BaseComparableVerifier.MessageKeys.GREATER_THAN_OR_EQUAL_TO), getArgsCaptor().capture());
+ verify(getMockVerification()).report(eq(expected), eq(BaseComparableVerifier.MessageKeys.GREATER_THAN_OR_EQUAL_TO), getArgsCaptor().capture());
assertSame("Passes other for message formatting", other, getArgsCaptor().getValue());
}
@@ -423,7 +423,7 @@ private void testGreaterThanOrEqualToHelper(T value, T other, Object otherName,
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().greaterThanOrEqualTo(other, otherName));
- verify(getMockVerification()).check(eq(expected), eq(BaseComparableVerifier.MessageKeys.GREATER_THAN_OR_EQUAL_TO), getArgsCaptor().capture());
+ verify(getMockVerification()).report(eq(expected), eq(BaseComparableVerifier.MessageKeys.GREATER_THAN_OR_EQUAL_TO), getArgsCaptor().capture());
assertSame("Passes other name for message formatting", otherName, getArgsCaptor().getValue());
}
@@ -463,7 +463,7 @@ private void testLessThanHelper(T value, T other, boolean expected) {
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().lessThan(other));
- verify(getMockVerification()).check(eq(expected), eq(BaseComparableVerifier.MessageKeys.LESS_THAN), getArgsCaptor().capture());
+ verify(getMockVerification()).report(eq(expected), eq(BaseComparableVerifier.MessageKeys.LESS_THAN), getArgsCaptor().capture());
assertSame("Passes other for message formatting", other, getArgsCaptor().getValue());
}
@@ -503,7 +503,7 @@ private void testLessThanHelper(T value, T other, Object otherName, boolean expe
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().lessThan(other, otherName));
- verify(getMockVerification()).check(eq(expected), eq(BaseComparableVerifier.MessageKeys.LESS_THAN), getArgsCaptor().capture());
+ verify(getMockVerification()).report(eq(expected), eq(BaseComparableVerifier.MessageKeys.LESS_THAN), getArgsCaptor().capture());
assertSame("Passes other name for message formatting", otherName, getArgsCaptor().getValue());
}
@@ -543,7 +543,7 @@ private void testLessThanOrEqualToHelper(T value, T other, boolean expected) {
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().lessThanOrEqualTo(other));
- verify(getMockVerification()).check(eq(expected), eq(BaseComparableVerifier.MessageKeys.LESS_THAN_OR_EQUAL_TO), getArgsCaptor().capture());
+ verify(getMockVerification()).report(eq(expected), eq(BaseComparableVerifier.MessageKeys.LESS_THAN_OR_EQUAL_TO), getArgsCaptor().capture());
assertSame("Passes other for message formatting", other, getArgsCaptor().getValue());
}
@@ -583,7 +583,7 @@ private void testLessThanOrEqualToHelper(T value, T other, Object otherName, boo
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().lessThanOrEqualTo(other, otherName));
- verify(getMockVerification()).check(eq(expected), eq(BaseComparableVerifier.MessageKeys.LESS_THAN_OR_EQUAL_TO), getArgsCaptor().capture());
+ verify(getMockVerification()).report(eq(expected), eq(BaseComparableVerifier.MessageKeys.LESS_THAN_OR_EQUAL_TO), getArgsCaptor().capture());
assertSame("Passes other name for message formatting", otherName, getArgsCaptor().getValue());
}
diff --git a/src/test/java/io/skelp/verifier/type/base/BaseNumberVerifierTestCase.java b/src/test/java/io/skelp/verifier/type/base/BaseNumberVerifierTestCase.java
index 4150ad9..c22532c 100644
--- a/src/test/java/io/skelp/verifier/type/base/BaseNumberVerifierTestCase.java
+++ b/src/test/java/io/skelp/verifier/type/base/BaseNumberVerifierTestCase.java
@@ -66,7 +66,7 @@ private void testEvenHelper(T value, boolean expected) {
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().even());
- verify(getMockVerification()).check(expected, BaseNumberVerifier.MessageKeys.EVEN);
+ verify(getMockVerification()).report(expected, BaseNumberVerifier.MessageKeys.EVEN);
}
@Test
@@ -94,7 +94,7 @@ private void testNegativeHelper(T value, boolean expected) {
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().negative());
- verify(getMockVerification()).check(expected, BaseNumberVerifier.MessageKeys.NEGATIVE);
+ verify(getMockVerification()).report(expected, BaseNumberVerifier.MessageKeys.NEGATIVE);
}
@Test
@@ -122,7 +122,7 @@ private void testOddHelper(T value, boolean expected) {
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().odd());
- verify(getMockVerification()).check(expected, BaseNumberVerifier.MessageKeys.ODD);
+ verify(getMockVerification()).report(expected, BaseNumberVerifier.MessageKeys.ODD);
}
@Test
@@ -150,7 +150,7 @@ private void testOneHelper(T value, boolean expected) {
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().one());
- verify(getMockVerification()).check(expected, BaseNumberVerifier.MessageKeys.ONE);
+ verify(getMockVerification()).report(expected, BaseNumberVerifier.MessageKeys.ONE);
}
@Test
@@ -178,7 +178,7 @@ private void testPositiveHelper(T value, boolean expected) {
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().positive());
- verify(getMockVerification()).check(expected, BaseNumberVerifier.MessageKeys.POSITIVE);
+ verify(getMockVerification()).report(expected, BaseNumberVerifier.MessageKeys.POSITIVE);
}
@Test
@@ -206,7 +206,7 @@ private void testZeroHelper(T value, boolean expected) {
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().zero());
- verify(getMockVerification()).check(expected, BaseNumberVerifier.MessageKeys.ZERO);
+ verify(getMockVerification()).report(expected, BaseNumberVerifier.MessageKeys.ZERO);
}
/**
diff --git a/src/test/java/io/skelp/verifier/type/base/BaseSortableCollectionVerifierTestCase.java b/src/test/java/io/skelp/verifier/type/base/BaseSortableCollectionVerifierTestCase.java
index bc785b6..61568c2 100644
--- a/src/test/java/io/skelp/verifier/type/base/BaseSortableCollectionVerifierTestCase.java
+++ b/src/test/java/io/skelp/verifier/type/base/BaseSortableCollectionVerifierTestCase.java
@@ -86,7 +86,7 @@ private void testSortedByHelper(T value, Comparator comparator, boolean compa
verify(comparator, comparatorUseExpected ? atLeastOnce() : never()).compare(any(getElementClass()), any(getElementClass()));
- verify(getMockVerification()).check(eq(expected), eq(BaseSortableCollectionVerifier.MessageKeys.SORTED_BY), getArgsCaptor().capture());
+ verify(getMockVerification()).report(eq(expected), eq(BaseSortableCollectionVerifier.MessageKeys.SORTED_BY), getArgsCaptor().capture());
assertSame("Passes comparator for message formatting", comparator, getArgsCaptor().getValue());
}
@@ -133,7 +133,7 @@ private void testSortedByHelper(T value, Comparator comparator, Object name,
verify(comparator, comparatorUseExpected ? atLeastOnce() : never()).compare(any(getElementClass()), any(getElementClass()));
- verify(getMockVerification()).check(eq(expected), eq(BaseSortableCollectionVerifier.MessageKeys.SORTED_BY), getArgsCaptor().capture());
+ verify(getMockVerification()).report(eq(expected), eq(BaseSortableCollectionVerifier.MessageKeys.SORTED_BY), getArgsCaptor().capture());
assertSame("Passes name for message formatting", name, getArgsCaptor().getValue());
}
diff --git a/src/test/java/io/skelp/verifier/type/base/BaseTimeVerifierTestCase.java b/src/test/java/io/skelp/verifier/type/base/BaseTimeVerifierTestCase.java
index a427e3c..85ea250 100644
--- a/src/test/java/io/skelp/verifier/type/base/BaseTimeVerifierTestCase.java
+++ b/src/test/java/io/skelp/verifier/type/base/BaseTimeVerifierTestCase.java
@@ -158,7 +158,7 @@ private void testSameDayAsHelper(Calendar valueCalendar, Calendar otherCalendar,
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().sameDayAs(other));
- verify(getMockVerification()).check(eq(expected), eq(BaseTimeVerifier.MessageKeys.SAME_DAY_AS), getArgsCaptor().capture());
+ verify(getMockVerification()).report(eq(expected), eq(BaseTimeVerifier.MessageKeys.SAME_DAY_AS), getArgsCaptor().capture());
assertSame("Passes other for message formatting", other, getArgsCaptor().getValue());
}
@@ -202,7 +202,7 @@ private void testSameEraAsHelper(Calendar valueCalendar, Calendar otherCalendar,
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().sameEraAs(other));
- verify(getMockVerification()).check(eq(expected), eq(BaseTimeVerifier.MessageKeys.SAME_ERA_AS), getArgsCaptor().capture());
+ verify(getMockVerification()).report(eq(expected), eq(BaseTimeVerifier.MessageKeys.SAME_ERA_AS), getArgsCaptor().capture());
assertSame("Passes other for message formatting", other, getArgsCaptor().getValue());
}
@@ -271,7 +271,7 @@ private void testSameHourAsHelper(Calendar valueCalendar, Calendar otherCalendar
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().sameHourAs(other));
- verify(getMockVerification()).check(eq(expected), eq(BaseTimeVerifier.MessageKeys.SAME_HOUR_AS), getArgsCaptor().capture());
+ verify(getMockVerification()).report(eq(expected), eq(BaseTimeVerifier.MessageKeys.SAME_HOUR_AS), getArgsCaptor().capture());
assertSame("Passes other for message formatting", other, getArgsCaptor().getValue());
}
@@ -347,7 +347,7 @@ private void testSameMinuteAsHelper(Calendar valueCalendar, Calendar otherCalend
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().sameMinuteAs(other));
- verify(getMockVerification()).check(eq(expected), eq(BaseTimeVerifier.MessageKeys.SAME_MINUTE_AS), getArgsCaptor().capture());
+ verify(getMockVerification()).report(eq(expected), eq(BaseTimeVerifier.MessageKeys.SAME_MINUTE_AS), getArgsCaptor().capture());
assertSame("Passes other for message formatting", other, getArgsCaptor().getValue());
}
@@ -407,7 +407,7 @@ private void testSameMonthAsHelper(Calendar valueCalendar, Calendar otherCalenda
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().sameMonthAs(other));
- verify(getMockVerification()).check(eq(expected), eq(BaseTimeVerifier.MessageKeys.SAME_MONTH_AS), getArgsCaptor().capture());
+ verify(getMockVerification()).report(eq(expected), eq(BaseTimeVerifier.MessageKeys.SAME_MONTH_AS), getArgsCaptor().capture());
assertSame("Passes other for message formatting", other, getArgsCaptor().getValue());
}
@@ -491,7 +491,7 @@ private void testSameSecondAsHelper(Calendar valueCalendar, Calendar otherCalend
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().sameSecondAs(other));
- verify(getMockVerification()).check(eq(expected), eq(BaseTimeVerifier.MessageKeys.SAME_SECOND_AS), getArgsCaptor().capture());
+ verify(getMockVerification()).report(eq(expected), eq(BaseTimeVerifier.MessageKeys.SAME_SECOND_AS), getArgsCaptor().capture());
assertSame("Passes other for message formatting", other, getArgsCaptor().getValue());
}
@@ -535,7 +535,7 @@ private void testSameTimeAsHelper(Calendar valueCalendar, Calendar otherCalendar
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().sameTimeAs(other));
- verify(getMockVerification()).check(eq(expected), eq(BaseTimeVerifier.MessageKeys.SAME_TIME_AS), getArgsCaptor().capture());
+ verify(getMockVerification()).report(eq(expected), eq(BaseTimeVerifier.MessageKeys.SAME_TIME_AS), getArgsCaptor().capture());
assertSame("Passes other for message formatting", other, getArgsCaptor().getValue());
}
@@ -595,7 +595,7 @@ private void testSameWeekAsHelper(Calendar valueCalendar, Calendar otherCalendar
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().sameWeekAs(other));
- verify(getMockVerification()).check(eq(expected), eq(BaseTimeVerifier.MessageKeys.SAME_WEEK_AS), getArgsCaptor().capture());
+ verify(getMockVerification()).report(eq(expected), eq(BaseTimeVerifier.MessageKeys.SAME_WEEK_AS), getArgsCaptor().capture());
assertSame("Passes other for message formatting", other, getArgsCaptor().getValue());
}
@@ -647,7 +647,7 @@ private void testSameYearAsHelper(Calendar valueCalendar, Calendar otherCalendar
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().sameYearAs(other));
- verify(getMockVerification()).check(eq(expected), eq(BaseTimeVerifier.MessageKeys.SAME_YEAR_AS), getArgsCaptor().capture());
+ verify(getMockVerification()).report(eq(expected), eq(BaseTimeVerifier.MessageKeys.SAME_YEAR_AS), getArgsCaptor().capture());
assertSame("Passes other for message formatting", other, getArgsCaptor().getValue());
}
diff --git a/src/test/java/io/skelp/verifier/type/base/BaseTruthVerifierTestCase.java b/src/test/java/io/skelp/verifier/type/base/BaseTruthVerifierTestCase.java
index 30da361..d27c69f 100644
--- a/src/test/java/io/skelp/verifier/type/base/BaseTruthVerifierTestCase.java
+++ b/src/test/java/io/skelp/verifier/type/base/BaseTruthVerifierTestCase.java
@@ -63,7 +63,7 @@ private void testFalsyHelper(T[] values, boolean expected) {
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().falsy());
}
- verify(getMockVerification(), times(values.length)).check(expected, BaseTruthVerifier.MessageKeys.FALSY);
+ verify(getMockVerification(), times(values.length)).report(expected, BaseTruthVerifier.MessageKeys.FALSY);
}
@Test
@@ -88,7 +88,7 @@ private void testTruthyHelper(T[] values, boolean expected) {
assertSame("Chains reference", getCustomVerifier(), getCustomVerifier().truthy());
}
- verify(getMockVerification(), times(values.length)).check(expected, BaseTruthVerifier.MessageKeys.TRUTHY);
+ verify(getMockVerification(), times(values.length)).report(expected, BaseTruthVerifier.MessageKeys.TRUTHY);
}
/**
diff --git a/src/test/java/io/skelp/verifier/verification/DefaultVerificationProviderTest.java b/src/test/java/io/skelp/verifier/verification/DefaultVerificationProviderTest.java
index a6e13a5..171dde4 100644
--- a/src/test/java/io/skelp/verifier/verification/DefaultVerificationProviderTest.java
+++ b/src/test/java/io/skelp/verifier/verification/DefaultVerificationProviderTest.java
@@ -38,6 +38,9 @@
import io.skelp.verifier.message.locale.LocaleContextProvider;
import io.skelp.verifier.message.locale.TestLocaleContextProvider;
import io.skelp.verifier.service.Weighted;
+import io.skelp.verifier.verification.report.ReportExecutor;
+import io.skelp.verifier.verification.report.ReportExecutorProvider;
+import io.skelp.verifier.verification.report.TestReportExecutorProvider;
/**
*
@@ -57,6 +60,10 @@ public class DefaultVerificationProviderTest {
private MessageSource mockMessageSource;
@Mock
private MessageSourceProvider mockMessageSourceProvider;
+ @Mock
+ private ReportExecutor mockReportExecutor;
+ @Mock
+ private ReportExecutorProvider mockReportExecutorProvider;
private DefaultVerificationProvider provider;
@@ -64,9 +71,11 @@ public class DefaultVerificationProviderTest {
public void setUp() {
when(mockLocaleContextProvider.getLocaleContext()).thenReturn(mockLocaleContext);
when(mockMessageSourceProvider.getMessageSource()).thenReturn(mockMessageSource);
+ when(mockReportExecutorProvider.getReportExecutor()).thenReturn(mockReportExecutor);
TestLocaleContextProvider.setDelegate(mockLocaleContextProvider);
TestMessageSourceProvider.setDelegate(mockMessageSourceProvider);
+ TestReportExecutorProvider.setDelegate(mockReportExecutorProvider);
provider = new DefaultVerificationProvider();
}
@@ -75,6 +84,7 @@ public void setUp() {
public void tearDown() {
TestLocaleContextProvider.setDelegate(null);
TestMessageSourceProvider.setDelegate(null);
+ TestReportExecutorProvider.setDelegate(null);
}
@Test
@@ -85,6 +95,7 @@ public void testGetVerification() {
assertTrue("Returns instance of SimpleVerification", verification instanceof SimpleVerification);
assertSame("Passed LocaleContext from provider", mockLocaleContext, verification.getLocaleContext());
assertSame("Passed MessageSource from provider", mockMessageSource, verification.getMessageSource());
+ assertSame("Passed ReportExecutor from provider", mockReportExecutor, verification.getReportExecutor());
assertEquals("Passed name", "foo", verification.getName());
assertEquals("Passed value", Integer.valueOf(123), verification.getValue());
}
diff --git a/src/test/java/io/skelp/verifier/verification/SimpleVerificationTest.java b/src/test/java/io/skelp/verifier/verification/SimpleVerificationTest.java
index 67b1631..140f019 100644
--- a/src/test/java/io/skelp/verifier/verification/SimpleVerificationTest.java
+++ b/src/test/java/io/skelp/verifier/verification/SimpleVerificationTest.java
@@ -22,13 +22,15 @@
package io.skelp.verifier.verification;
import static org.junit.Assert.*;
+import static org.mockito.AdditionalMatchers.*;
import static org.mockito.Mockito.*;
+import static org.mockito.Mockito.eq;
-import org.junit.Rule;
+import org.junit.Before;
import org.junit.Test;
-import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith;
-import org.mockito.Matchers;
+import org.mockito.ArgumentCaptor;
+import org.mockito.Captor;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
@@ -36,6 +38,8 @@
import io.skelp.verifier.message.MessageKey;
import io.skelp.verifier.message.MessageSource;
import io.skelp.verifier.message.locale.LocaleContext;
+import io.skelp.verifier.verification.report.MessageHolder;
+import io.skelp.verifier.verification.report.ReportExecutor;
/**
*
@@ -47,149 +51,113 @@
@RunWith(MockitoJUnitRunner.class)
public class SimpleVerificationTest {
- @Rule
- public ExpectedException thrown = ExpectedException.none();
+ private static final Object TEST_NAME = "foo";
+ private static final Object TEST_VALUE = 123;
+ @Captor
+ private ArgumentCaptor messageHolderCaptor;
@Mock
private LocaleContext mockLocaleContext;
@Mock
private MessageSource mockMessageSource;
+ @Mock
+ private ReportExecutor mockReportExecutor;
- @Test
- public void testCheckWithMessageWhenResultIsBad() {
- thrown.expect(VerifierException.class);
- thrown.expectMessage("i am expected");
-
- SimpleVerification> verification = new SimpleVerification<>(mockLocaleContext, mockMessageSource, null, null);
-
- when(mockMessageSource.getMessage(same(verification), eq("test"), Matchers.anyVararg())).thenReturn("i am expected");
+ private SimpleVerification> verification;
- try {
- verification.check(false, "test", "foo", "bar");
- fail("VerifierException expected");
- } catch (VerifierException e) {
- assertFalse("Still not negated", verification.isNegated());
- throw e;
- }
+ @Before
+ public void setUp() {
+ verification = new SimpleVerification<>(mockLocaleContext, mockMessageSource, mockReportExecutor, TEST_VALUE, TEST_NAME);
}
@Test
- public void testCheckWithMessageWhenResultIsBadAndIsNegated() {
- SimpleVerification> verification = new SimpleVerification<>(mockLocaleContext, mockMessageSource, null, null);
+ public void testReportWithMessage() {
verification.setNegated(true);
- assertSame("Chains reference", verification, verification.check(false, "test", "foo", "bar"));
- assertFalse("No longer negated", verification.isNegated());
- }
+ verification.report(false, "test", "foo", "bar");
- @Test
- public void testCheckWithMessageWhenResultIsGood() {
- SimpleVerification> verification = new SimpleVerification<>(mockLocaleContext, mockMessageSource, null, null);
+ assertFalse("Negated state is reset", verification.isNegated());
- assertSame("Chains reference", verification, verification.check(true, "test", "foo", "bar"));
- assertFalse("Still not negated", verification.isNegated());
- }
+ verify(mockReportExecutor).execute(eq(verification), eq(false), messageHolderCaptor.capture());
- @Test
- public void testCheckWithMessageWhenResultIsGoodAndIsNegated() {
- thrown.expect(VerifierException.class);
- thrown.expectMessage("i am expected");
+ MessageHolder messageHolder = messageHolderCaptor.getValue();
- SimpleVerification> verification = new SimpleVerification<>(mockLocaleContext, mockMessageSource, null, null);
- verification.setNegated(true);
+ assertNotNull("Message holder is never null", messageHolder);
- when(mockMessageSource.getMessage(same(verification), eq("test"), Matchers.anyVararg())).thenReturn("i am expected");
+ messageHolder.getMessage(verification);
- try {
- verification.check(true, "test", "foo", "bar");
- fail("VerifierException expected");
- } catch (VerifierException e) {
- assertFalse("No longer negated", verification.isNegated());
- throw e;
- }
+ verify(mockMessageSource).getMessage(eq(verification), eq("test"), aryEq(new Object[]{"foo", "bar"}));
}
- @Test
- public void testCheckWithMessageKeyWhenResultIsBad() {
- thrown.expect(VerifierException.class);
- thrown.expectMessage("i am expected");
+ @Test(expected = VerifierException.class)
+ public void testReportWithMessageWhenReportExecutorThrows() {
+ doThrow(new VerifierException()).when(mockReportExecutor).execute(eq(verification), eq(true), isA(MessageHolder.class));
- MessageKey key = () -> "test";
- SimpleVerification> verification = new SimpleVerification<>(mockLocaleContext, mockMessageSource, null, null);
-
- when(mockMessageSource.getMessage(same(verification), same(key), Matchers.anyVararg())).thenReturn("i am expected");
+ verification.setNegated(true);
try {
- verification.check(false, key, "foo", "bar");
- fail("VerifierException expected");
- } catch (VerifierException e) {
- assertFalse("Still not negated", verification.isNegated());
- throw e;
+ verification.report(true, "test", "foo", "bar");
+ } finally {
+ assertFalse("Negated state is reset", verification.isNegated());
}
}
@Test
- public void testCheckWithMessageKeyWhenResultIsBadAndIsNegated() {
- SimpleVerification> verification = new SimpleVerification<>(mockLocaleContext, mockMessageSource, null, null);
+ public void testReportWithMessageKey() {
+ MessageKey key = () -> "test";
+
verification.setNegated(true);
- assertSame("Chains reference", verification, verification.check(false, () -> "test", "foo", "bar"));
- assertFalse("No longer negated", verification.isNegated());
- }
+ verification.report(false, key, "foo", "bar");
- @Test
- public void testCheckWithMessageKeyWhenResultIsGood() {
- SimpleVerification> verification = new SimpleVerification<>(mockLocaleContext, mockMessageSource, null, null);
+ assertFalse("Negated state is reset", verification.isNegated());
+
+ verify(mockReportExecutor).execute(eq(verification), eq(false), messageHolderCaptor.capture());
+
+ MessageHolder messageHolder = messageHolderCaptor.getValue();
- assertSame("Chains reference", verification, verification.check(true, () -> "test", "foo", "bar"));
- assertFalse("Still not negated", verification.isNegated());
+ assertNotNull("Message holder is never null", messageHolder);
+
+ messageHolder.getMessage(verification);
+
+ verify(mockMessageSource).getMessage(eq(verification), eq(key), aryEq(new Object[]{"foo", "bar"}));
}
- @Test
- public void testCheckWithMessageKeyWhenResultIsGoodAndIsNegated() {
- thrown.expect(VerifierException.class);
- thrown.expectMessage("i am expected");
+ @Test(expected = VerifierException.class)
+ public void testReportWithMessageKeyWhenReportExecutorThrows() {
+ doThrow(new VerifierException()).when(mockReportExecutor).execute(eq(verification), eq(true), isA(MessageHolder.class));
- MessageKey key = () -> "test";
- SimpleVerification> verification = new SimpleVerification<>(mockLocaleContext, mockMessageSource, null, null);
verification.setNegated(true);
- when(mockMessageSource.getMessage(same(verification), same(key), Matchers.anyVararg())).thenReturn("i am expected");
-
try {
- verification.check(true, key, "foo", "bar");
- fail("VerifierException expected");
- } catch (VerifierException e) {
- assertFalse("No longer negated", verification.isNegated());
- throw e;
+ verification.report(true, () -> "test", "foo", "bar");
+ } finally {
+ assertFalse("Negated state is reset", verification.isNegated());
}
}
@Test
public void testLocaleContext() {
- SimpleVerification> verification = new SimpleVerification<>(mockLocaleContext, null, null, null);
-
assertEquals("LocaleContext property is readable", mockLocaleContext, verification.getLocaleContext());
}
@Test
public void testMessageSource() {
- SimpleVerification> verification = new SimpleVerification<>(null, mockMessageSource, null, null);
-
assertEquals("MessageSource property is readable", mockMessageSource, verification.getMessageSource());
}
@Test
- public void testName() {
- SimpleVerification> verification = new SimpleVerification<>(null, null, null, "foo");
+ public void testReportExecutor() {
+ assertEquals("ReportExecutor property is readable", mockReportExecutor, verification.getReportExecutor());
+ }
- assertEquals("Name property is readable", "foo", verification.getName());
+ @Test
+ public void testName() {
+ assertEquals("Name property is readable", TEST_NAME, verification.getName());
}
@Test
public void testNegated() {
- SimpleVerification> verification = new SimpleVerification<>(null, null, null, null);
-
assertFalse("Negated property is readable and is false by default", verification.isNegated());
verification.setNegated(true);
@@ -199,8 +167,6 @@ public void testNegated() {
@Test
public void testValue() {
- SimpleVerification> verification = new SimpleVerification<>(null, null, 123, null);
-
- assertEquals("Value property is readable", 123, verification.getValue());
+ assertEquals("Value property is readable", TEST_VALUE, verification.getValue());
}
}
diff --git a/src/test/java/io/skelp/verifier/verification/report/AbstractReportExecutorTestCase.java b/src/test/java/io/skelp/verifier/verification/report/AbstractReportExecutorTestCase.java
new file mode 100644
index 0000000..e6f500c
--- /dev/null
+++ b/src/test/java/io/skelp/verifier/verification/report/AbstractReportExecutorTestCase.java
@@ -0,0 +1,154 @@
+/*
+ * Copyright (C) 2017 Alasdair Mercer, Skelp
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package io.skelp.verifier.verification.report;
+
+import static org.junit.Assert.*;
+import static org.mockito.Mockito.*;
+
+import java.util.Arrays;
+import java.util.List;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.experimental.theories.DataPoints;
+import org.junit.experimental.theories.Theories;
+import org.junit.experimental.theories.Theory;
+import org.junit.rules.ExpectedException;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+
+import io.skelp.verifier.VerifierException;
+import io.skelp.verifier.verification.Verification;
+
+/**
+ *
+ * Test case for {@link AbstractReportExecutor} implementation classes.
+ *
+ *
+ * @param
+ * the type of the {@link AbstractReportExecutor} being tested
+ * @author Alasdair Mercer
+ */
+@RunWith(Theories.class)
+public abstract class AbstractReportExecutorTestCase {
+
+ @DataPoints
+ public static final boolean[] DATA_POINTS = {true, false};
+
+ @Rule
+ public ExpectedException thrown = ExpectedException.none();
+
+ @Mock
+ private MessageHolder mockMessageHolder;
+ @Mock
+ private Reporter mockReporter1;
+ @Mock
+ private Reporter mockReporter2;
+ @Mock
+ private Reporter mockReporter3;
+ @Mock
+ private Verification> mockVerification;
+
+ private List reporters;
+
+ private T reportExecutor;
+
+ @Before
+ public void setUp() {
+ MockitoAnnotations.initMocks(this);
+
+ reporters = Arrays.asList(mockReporter1, mockReporter2, mockReporter3);
+
+ reportExecutor = createReportExecutor(reporters);
+ }
+
+ @Theory
+ public void testExecute(boolean result) {
+ when(mockReporter1.report(mockVerification, result, mockMessageHolder)).thenReturn(true);
+ when(mockReporter2.report(mockVerification, result, mockMessageHolder)).thenReturn(true);
+ when(mockReporter3.report(mockVerification, result, mockMessageHolder)).thenReturn(true);
+
+ reportExecutor.execute(mockVerification, result, mockMessageHolder);
+
+ verify(mockReporter1).report(mockVerification, result, mockMessageHolder);
+ verify(mockReporter2).report(mockVerification, result, mockMessageHolder);
+ verify(mockReporter3).report(mockVerification, result, mockMessageHolder);
+ }
+
+ @Theory
+ public void testExecuteWhenReporterBlocksNext(boolean result) {
+ when(mockReporter1.report(mockVerification, result, mockMessageHolder)).thenReturn(true);
+ when(mockReporter2.report(mockVerification, result, mockMessageHolder)).thenReturn(false);
+ when(mockReporter3.report(mockVerification, result, mockMessageHolder)).thenReturn(true);
+
+ reportExecutor.execute(mockVerification, result, mockMessageHolder);
+
+ verify(mockReporter1).report(mockVerification, result, mockMessageHolder);
+ verify(mockReporter2).report(mockVerification, result, mockMessageHolder);
+ verify(mockReporter3, never()).report(mockVerification, result, mockMessageHolder);
+ }
+
+ @Theory
+ public void testExecuteWhenReporterThrows(boolean result) {
+ thrown.expect(VerifierException.class);
+
+ when(mockReporter1.report(mockVerification, result, mockMessageHolder)).thenReturn(true);
+ when(mockReporter2.report(mockVerification, result, mockMessageHolder)).thenThrow(new VerifierException());
+ when(mockReporter3.report(mockVerification, result, mockMessageHolder)).thenReturn(true);
+
+ try {
+ reportExecutor.execute(mockVerification, result, mockMessageHolder);
+ } finally {
+ verify(mockReporter1).report(mockVerification, result, mockMessageHolder);
+ verify(mockReporter2).report(mockVerification, result, mockMessageHolder);
+ verify(mockReporter3, never()).report(mockVerification, result, mockMessageHolder);
+ }
+ }
+
+ @Test
+ public void testGetReporters() {
+ assertEquals("Has correct list of reporters", reporters, reportExecutor.getReporters());
+ }
+
+ /**
+ *
+ * Creates an instance of the reporter executor test subject to be tested using the {@code reporters} provided.
+ *
+ *
+ * @param reporters
+ * the {@link Reporter Reporters} to be used
+ * @return The {@link AbstractReportExecutor} to be tested.F
+ */
+ protected abstract T createReportExecutor(List reporters);
+
+ /**
+ *
+ * Returns the reporters being used to test the subject.
+ *
+ *
+ * @return The {@code List} of {@link Reporter Reporters}.
+ */
+ protected List getReporters() {
+ return reporters;
+ }
+}
diff --git a/src/test/java/io/skelp/verifier/verification/report/AssertionReporterTest.java b/src/test/java/io/skelp/verifier/verification/report/AssertionReporterTest.java
new file mode 100644
index 0000000..91558a3
--- /dev/null
+++ b/src/test/java/io/skelp/verifier/verification/report/AssertionReporterTest.java
@@ -0,0 +1,103 @@
+/*
+ * Copyright (C) 2017 Alasdair Mercer, Skelp
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package io.skelp.verifier.verification.report;
+
+import static org.junit.Assert.*;
+import static org.mockito.Mockito.*;
+
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.runners.MockitoJUnitRunner;
+
+import io.skelp.verifier.VerifierException;
+import io.skelp.verifier.service.Weighted;
+import io.skelp.verifier.verification.Verification;
+
+/**
+ *
+ * Tests for the {@link AssertionReporter} class.
+ *
+ *
+ * @author Alasdair Mercer
+ */
+@RunWith(MockitoJUnitRunner.class)
+public class AssertionReporterTest {
+
+ private static final String TEST_MESSAGE = "i am expected";
+
+ @Rule
+ public ExpectedException thrown = ExpectedException.none();
+
+ @Mock
+ private MessageHolder mockMessageHolder;
+ @Mock
+ private Verification> mockVerification;
+
+ private AssertionReporter reporter;
+
+ @Before
+ public void setUp() {
+ when(mockMessageHolder.getMessage(mockVerification)).thenReturn(TEST_MESSAGE);
+
+ reporter = new AssertionReporter();
+ }
+
+ @Test
+ public void testReportWhenResultIsFalse() {
+ testReportHelper(false, false, true);
+ }
+
+ @Test
+ public void testReportWhenResultIsFalseAndVerificationIsNegated() {
+ testReportHelper(true, false, false);
+ }
+
+ @Test
+ public void testReportWhenResultIsTrue() {
+ testReportHelper(false, true, false);
+ }
+
+ @Test
+ public void testReportWhenResultIsTrueAndVerificationIsNegated() {
+ testReportHelper(true, true, true);
+ }
+
+ private void testReportHelper(boolean negated, boolean result, boolean exceptionExpected) {
+ if (exceptionExpected) {
+ thrown.expect(VerifierException.class);
+ thrown.expectMessage(TEST_MESSAGE);
+ }
+
+ when(mockVerification.isNegated()).thenReturn(negated);
+
+ assertTrue("Never returns false", reporter.report(mockVerification, result, mockMessageHolder));
+ }
+
+ @Test
+ public void testGetWeight() {
+ assertEquals("Has default implementation weight", Weighted.DEFAULT_IMPLEMENTATION_WEIGHT, reporter.getWeight());
+ }
+}
diff --git a/src/test/java/io/skelp/verifier/verification/report/DefaultReportExecutorProviderTest.java b/src/test/java/io/skelp/verifier/verification/report/DefaultReportExecutorProviderTest.java
new file mode 100644
index 0000000..d66bfec
--- /dev/null
+++ b/src/test/java/io/skelp/verifier/verification/report/DefaultReportExecutorProviderTest.java
@@ -0,0 +1,77 @@
+/*
+ * Copyright (C) 2017 Alasdair Mercer, Skelp
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package io.skelp.verifier.verification.report;
+
+import static org.junit.Assert.*;
+
+import java.util.List;
+import org.junit.Before;
+import org.junit.Test;
+
+import io.skelp.verifier.service.Weighted;
+
+/**
+ *
+ * Tests for the {@link DefaultReportExecutorProvider} class.
+ *
+ *
+ * @author Alasdair Mercer
+ */
+public class DefaultReportExecutorProviderTest {
+
+ private static void assertReporters(ReportExecutor reportExecutor, Class>[] reporterClasses) {
+ List reporters = reportExecutor.getReporters();
+
+ assertNotNull("Has reporters", reporters);
+ assertEquals("Has correct number of reporters", reporterClasses.length, reporters.size());
+
+ for (int i = 0; i < reporterClasses.length; i++) {
+ Reporter reporter = reporters.get(i);
+ Class> reporterClass = reporterClasses[i];
+
+ assertNotNull("Reporter[" + i + "] is never null", reporter);
+ assertTrue("Reporter[" + i + "] is of expected type", reporterClass.isInstance(reporter));
+ }
+ }
+
+ private DefaultReportExecutorProvider provider;
+
+ @Before
+ public void setUp() {
+ provider = new DefaultReportExecutorProvider();
+ }
+
+ @Test
+ public void testGetReportExecutor() {
+ ReportExecutor reportExecutor = provider.getReportExecutor();
+
+ assertNotNull("Never returns null", reportExecutor);
+ assertTrue("Returns instance of SimpleReportExecutor", reportExecutor instanceof SimpleReportExecutor);
+
+ assertReporters(reportExecutor, new Class>[]{AssertionReporter.class});
+ }
+
+ @Test
+ public void testGetWeight() {
+ assertEquals("Has default implementation weight", Weighted.DEFAULT_IMPLEMENTATION_WEIGHT, provider.getWeight());
+ }
+}
diff --git a/src/test/java/io/skelp/verifier/verification/report/KeyMessageHolderTest.java b/src/test/java/io/skelp/verifier/verification/report/KeyMessageHolderTest.java
new file mode 100644
index 0000000..720f2a7
--- /dev/null
+++ b/src/test/java/io/skelp/verifier/verification/report/KeyMessageHolderTest.java
@@ -0,0 +1,68 @@
+/*
+ * Copyright (C) 2017 Alasdair Mercer, Skelp
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package io.skelp.verifier.verification.report;
+
+import static org.junit.Assert.*;
+import static org.mockito.Mockito.*;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.runners.MockitoJUnitRunner;
+
+import io.skelp.verifier.message.MessageKey;
+import io.skelp.verifier.message.MessageSource;
+import io.skelp.verifier.verification.Verification;
+
+/**
+ *
+ * Tests for the {@link KeyMessageHolder} class.
+ *
+ *
+ * @author Alasdair Mercer
+ */
+@RunWith(MockitoJUnitRunner.class)
+public class KeyMessageHolderTest {
+
+ @Mock
+ private MessageSource mockMessageSource;
+ @Mock
+ private Verification> mockVerification;
+
+ @Before
+ public void setUp() {
+ when(mockVerification.getMessageSource()).thenReturn(mockMessageSource);
+ }
+
+ @Test
+ public void testGetMessage() {
+ String expected = "i am expected";
+ MessageKey key = () -> "test";
+ Object[] args = new Object[]{"foo", "bar"};
+
+ when(mockMessageSource.getMessage(mockVerification, key, args)).thenReturn(expected);
+
+ KeyMessageHolder holder = new KeyMessageHolder(key, args);
+ assertEquals("Uses message source to return message", expected, holder.getMessage(mockVerification));
+ }
+}
diff --git a/src/test/java/io/skelp/verifier/verification/report/SimpleReportExecutorTest.java b/src/test/java/io/skelp/verifier/verification/report/SimpleReportExecutorTest.java
new file mode 100644
index 0000000..f5502d6
--- /dev/null
+++ b/src/test/java/io/skelp/verifier/verification/report/SimpleReportExecutorTest.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2017 Alasdair Mercer, Skelp
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package io.skelp.verifier.verification.report;
+
+import java.util.List;
+
+/**
+ *
+ * Tests for the {@link SimpleReportExecutor} class.
+ *
+ *
+ * @author Alasdair Mercer
+ */
+public class SimpleReportExecutorTest extends AbstractReportExecutorTestCase {
+
+ @Override
+ protected SimpleReportExecutor createReportExecutor(List reporters) {
+ return new SimpleReportExecutor(reporters);
+ }
+}
diff --git a/src/test/java/io/skelp/verifier/verification/report/StringMessageHolderTest.java b/src/test/java/io/skelp/verifier/verification/report/StringMessageHolderTest.java
new file mode 100644
index 0000000..ec1cc5c
--- /dev/null
+++ b/src/test/java/io/skelp/verifier/verification/report/StringMessageHolderTest.java
@@ -0,0 +1,67 @@
+/*
+ * Copyright (C) 2017 Alasdair Mercer, Skelp
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package io.skelp.verifier.verification.report;
+
+import static org.junit.Assert.*;
+import static org.mockito.Mockito.*;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.runners.MockitoJUnitRunner;
+
+import io.skelp.verifier.message.MessageSource;
+import io.skelp.verifier.verification.Verification;
+
+/**
+ *
+ * Tests for the {@link StringMessageHolder} class.
+ *
+ *
+ * @author Alasdair Mercer
+ */
+@RunWith(MockitoJUnitRunner.class)
+public class StringMessageHolderTest {
+
+ @Mock
+ private MessageSource mockMessageSource;
+ @Mock
+ private Verification> mockVerification;
+
+ @Before
+ public void setUp() {
+ when(mockVerification.getMessageSource()).thenReturn(mockMessageSource);
+ }
+
+ @Test
+ public void testGetMessage() {
+ String expected = "i am expected";
+ String message = "test";
+ Object[] args = new Object[]{"foo", "bar"};
+
+ when(mockMessageSource.getMessage(mockVerification, message, args)).thenReturn(expected);
+
+ StringMessageHolder holder = new StringMessageHolder(message, args);
+ assertEquals("Uses message source to return message", expected, holder.getMessage(mockVerification));
+ }
+}
diff --git a/src/test/java/io/skelp/verifier/verification/report/TestReportExecutorProvider.java b/src/test/java/io/skelp/verifier/verification/report/TestReportExecutorProvider.java
new file mode 100644
index 0000000..f2965e8
--- /dev/null
+++ b/src/test/java/io/skelp/verifier/verification/report/TestReportExecutorProvider.java
@@ -0,0 +1,72 @@
+/*
+ * Copyright (C) 2017 Alasdair Mercer, Skelp
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package io.skelp.verifier.verification.report;
+
+/**
+ *
+ * An implementation of {@link ReportExecutorProvider} that is intended to be used for test purposes only by allowing
+ * tests to register a delegate (normally a mock).
+ *
+ *
+ * Individual tests are also responsible for ensuring that the delegate is cleared in their tear down to avoid
+ * potentially affecting other unit tests.
+ *
+ *
+ * @author Alasdair Mercer
+ */
+public final class TestReportExecutorProvider implements ReportExecutorProvider {
+
+ private static ReportExecutorProvider delegate;
+
+ /**
+ *
+ * Returns the delegate for this {@link TestReportExecutorProvider}.
+ *
+ *
+ * @return The delegate {@link ReportExecutorProvider} or {@literal null} if none has been specified.
+ */
+ public static ReportExecutorProvider getDelegate() {
+ return delegate;
+ }
+
+ /**
+ *
+ * Sets the delegate for this {@link TestReportExecutorProvider} to {@code delegate}.
+ *
+ *
+ * @param delegate
+ * the delegate {@link ReportExecutorProvider} to be set (may be {@literal null})
+ */
+ public static void setDelegate(ReportExecutorProvider delegate) {
+ TestReportExecutorProvider.delegate = delegate;
+ }
+
+ @Override
+ public ReportExecutor getReportExecutor() {
+ return delegate != null ? delegate.getReportExecutor() : null;
+ }
+
+ @Override
+ public int getWeight() {
+ return 0;
+ }
+}
diff --git a/src/test/resources/META-INF/services/io.skelp.verifier.verification.report.ReportExecutorProvider b/src/test/resources/META-INF/services/io.skelp.verifier.verification.report.ReportExecutorProvider
new file mode 100644
index 0000000..c114787
--- /dev/null
+++ b/src/test/resources/META-INF/services/io.skelp.verifier.verification.report.ReportExecutorProvider
@@ -0,0 +1,2 @@
+io.skelp.verifier.verification.report.DefaultReportExecutorProvider
+io.skelp.verifier.verification.report.TestReportExecutorProvider