Name
Assert
Description
Assert
(see Figure B-1) contains only static methods. Its
public interface consists solely of unit test assert methods. These
methods throw an AssertionFailedError
or
ComparisonFailure
if the test fails.
Assert
is a parent class of
TestCase
and other classes that use unit test
assert methods.
Declaration
public class Assert extends Object
Constructors
-
protected Assert( )
Constructor for
Assert
. It is protected since this is a static class.
Public Methods
-
static void assertEquals(boolean expected, boolean actual)
static void assertEquals(String message, boolean expected, boolean actual)
Asserts equality of two
boolean
values.-
static void assertEquals(byte expected, byte actual)
static void assertEquals(String message, byte expected, byte actual)
Asserts equality of two
byte
values.-
static void assertEquals(char expected, char actual)
static void assertEquals(String message, char expected, char actual)
Asserts equality of two
char
values.-
static void assertEquals(double expected, double actual, double delta)
static void assertEquals(String message, double expected, double actual, double delta)
Asserts equality of two
double
values within a tolerance ofdelta
. Adelta
of tests exact equality.-
static void assertEquals(float expected, float actual, float delta)
static void assertEquals(String message, float expected, float actual, float ...
Get Unit Test Frameworks now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.