nl.jqno.equalsverifier.util
Class Assert

java.lang.Object
  extended by nl.jqno.equalsverifier.util.Assert

public class Assert
extends Object

Alternative for org.junit.Assert, so we can assert things without having a dependency on JUnit.

Author:
Jan Ouwens

Method Summary
static void assertEquals(Formatter message, Object expected, Object actual)
          Asserts that two Objects are equal to one another.
static void assertFalse(Formatter message, boolean assertion)
          Asserts that an assertion is true.
static void assertTrue(Formatter message, boolean assertion)
          Asserts that an assertion is false.
static void fail(Formatter message)
          Throws an AssertionException.
static void fail(Formatter message, Throwable cause)
          Throws an AssertionException.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

assertEquals

public static void assertEquals(Formatter message,
                                Object expected,
                                Object actual)
Asserts that two Objects are equal to one another. Does nothing if they are; throws an AssertionException if they're not.

Parameters:
message - Message to be included in the AssertionException.
expected - Expected value.
actual - Actual value.
Throws:
AssertionException - If expected and actual are not equal.

assertFalse

public static void assertFalse(Formatter message,
                               boolean assertion)
Asserts that an assertion is true. Does nothing if it is; throws an AssertionException if it isn't.

Parameters:
message - Message to be included in the AssertionException.
assertion - Assertion that must be true.
Throws:
AssertionException - If assertion is false.

assertTrue

public static void assertTrue(Formatter message,
                              boolean assertion)
Asserts that an assertion is false. Does nothing if it is; throws an AssertionException if it isn't.

Parameters:
message - Message to be included in the AssertionException.
assertion - Assertion that must be true.
Throws:
AssertionException - If assertion is false.

fail

public static void fail(Formatter message)
Throws an AssertionException.

Parameters:
message - Message to be included in the AssertionException.
Throws:
AssertionException - Always.

fail

public static void fail(Formatter message,
                        Throwable cause)
Throws an AssertionException.

Parameters:
message - Message to be included in the AssertionException.
Throws:
AssertionException - Always.


Copyright © 2015. All Rights Reserved.