All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.junit.rules.Verifier Maven / Gradle / Ivy

Go to download

Statistical sampling library for use in virtualdataset libraries, based on apache commons math 4

There is a newer version: 2.12.15
Show newest version
package org.junit.rules;

import org.junit.runner.Description;
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
 *
 * 
 *     public static class ErrorLogVerifier {
 *        private ErrorLog errorLog = new ErrorLog();
 *
 *        @Rule
 *        public Verifier verifier = new Verifier() {
 *           @Override public void verify() {
 *              assertTrue(errorLog.isEmpty());
 *           }
 *        }
 *
 *        @Test public void testThatMightWriteErrorLog() {
 *           // ...
 *        }
 *     }
 * 
* * @since 4.7 */ 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 { } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy