Verifier (JUnit API)
Keywords: org.junit.rules.Verifier class

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.junit.rules
Class Verifier

    java.lang.Object
      org.junit.rules.Verifier

All Implemented Interfaces:
  MethodRule

Direct Known Subclasses:
  ErrorCollector

    public class Verifier

extends Object
implements MethodRule

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

         public static class ErrorLogVerifier() {
            private ErrorLog errorLog = new ErrorLog();

            @Rule
            public MethodRule verifier = new Verifier() {
               @Override public void verify() {
                  assertTrue(errorLog.isEmpty());
               }
            }

            @Test public void testThatMightWriteErrorLog() {
               // ...
            }
         }

Constructor Summary
`Verifier()`

Method Summary
`Statement` | `apply(Statement base, FrameworkMethod method, Object target)` Modifies the method-running `Statement` to implement an additional test-running rule.
`protected void` | `verify()` Override this to add verification logic.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### Verifier

    public Verifier()

Method Detail

### apply

    public Statement apply(Statement base,
                           FrameworkMethod method,
                           Object target)

  Description copied from interface: `MethodRule`
  Modifies the method-running `Statement` to implement an additional test-running rule.

  Specified by:
    `apply` in interface `MethodRule`
  Parameters:
    `base` - The `Statement` to be modified
    `method` - The method to be run
    `target` - The object on with the method will be run.
  Returns:
    a new statement, which may be the same as `base`, a wrapper around `base`, or a completely new Statement.

### verify

    protected void verify()
                   throws Throwable

  Override this to add verification logic. Overrides should throw an exception to indicate that verification failed.

  Throws:
    `Throwable`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD