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

com.atlassian.clover.Contract Maven / Gradle / Ivy

Go to download

Clover is an award winning code coverage and testing tool for Java and Groovy. It integrates easily with Maven, Ant, Grails, Eclipse and IntelliJ IDEA as well as with continuous integration servers such as Bamboo, Jenkins or Hudson. Note: before Clover 4.0 this artifact was named com.cenqua.clover:clover.

The newest version!
package com.atlassian.clover;


public class Contract {
    /** use to log messages **/
    private static final Logger LOG = Logger.getInstance();

    private Contract() {
    }

    private static void fail(String msg) {
        ContractFailedException e = new ContractFailedException(msg);
        LOG.error(e.getMessage(), e);
        throw e;
    }


    public static void check(boolean cond, String desc) {
        if (!cond) {
            fail("Assertion failed: " + desc);
        }
    }

    public static void pre(boolean cond) {
        if (!cond) {
            fail("Precondition failed");
        }
    }

    public static void post(boolean cond) {
        if (!cond) {
            fail("Postcondition failed");
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy