aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/junit/rules/Verifier.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/org/junit/rules/Verifier.java')
-rw-r--r--src/main/java/org/junit/rules/Verifier.java44
1 files changed, 23 insertions, 21 deletions
diff --git a/src/main/java/org/junit/rules/Verifier.java b/src/main/java/org/junit/rules/Verifier.java
index be1a55e..7a03b0c 100644
--- a/src/main/java/org/junit/rules/Verifier.java
+++ b/src/main/java/org/junit/rules/Verifier.java
@@ -7,39 +7,41 @@ import org.junit.runners.model.Statement;
* Verifier is a base class for Rules like ErrorCollector, which can turn
* otherwise passing test methods into failing tests if a verification check is
* failed
- *
+ *
* <pre>
- * public static class ErrorLogVerifier() {
+ * public static class ErrorLogVerifier {
* private ErrorLog errorLog = new ErrorLog();
- *
+ *
* &#064;Rule
- * public MethodRule verifier = new Verifier() {
+ * public Verifier verifier = new Verifier() {
* &#064;Override public void verify() {
* assertTrue(errorLog.isEmpty());
* }
* }
- *
+ *
* &#064;Test public void testThatMightWriteErrorLog() {
* // ...
* }
* }
* </pre>
+ *
+ * @since 4.7
*/
-public class Verifier implements TestRule {
- public Statement apply(final Statement base, Description description) {
- return new Statement() {
- @Override
- public void evaluate() throws Throwable {
- base.evaluate();
- verify();
- }
- };
- }
+public abstract class Verifier implements TestRule {
+ public Statement apply(final Statement base, Description description) {
+ return new Statement() {
+ @Override
+ public void evaluate() throws Throwable {
+ base.evaluate();
+ verify();
+ }
+ };
+ }
- /**
- * Override this to add verification logic. Overrides should throw an
- * exception to indicate that verification failed.
- */
- protected void verify() throws Throwable {
- }
+ /**
+ * Override this to add verification logic. Overrides should throw an
+ * exception to indicate that verification failed.
+ */
+ protected void verify() throws Throwable {
+ }
}