Class Assert
- java.lang.Object
-
- nl.jqno.equalsverifier.internal.util.Assert
-
public final class Assert extends java.lang.Object
Alternative for org.junit.Assert, so we can assert things without having a dependency on JUnit.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
assertEquals(Formatter message, java.lang.Object expected, java.lang.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, java.lang.Throwable cause)
Throws an AssertionException.
-
-
-
Method Detail
-
assertEquals
public static void assertEquals(Formatter message, java.lang.Object expected, java.lang.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 theAssertionException
.expected
- Expected value.actual
- Actual value.- Throws:
AssertionException
- Ifexpected
andactual
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 theAssertionException
.assertion
- Assertion that must be true.- Throws:
AssertionException
- Ifassertion
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 theAssertionException
.assertion
- Assertion that must be true.- Throws:
AssertionException
- Ifassertion
is false.
-
fail
public static void fail(Formatter message)
Throws an AssertionException.- Parameters:
message
- Message to be included in theAssertionException
.- Throws:
AssertionException
- Always.
-
fail
public static void fail(Formatter message, java.lang.Throwable cause)
Throws an AssertionException.- Parameters:
message
- Message to be included in theAssertionException
.cause
- Throwable to be included as cause in theAssertionException
. Can be null.- Throws:
AssertionException
- Always.
-
-