org.testng
Class Assert

java.lang.Object  extended by org.testng.Assert

public class Assert
extends Object

Assertion tool class. Presents assertion methods with a more natural parameter order. The order is always actualValue, expectedValue [, message].

Author:
Alexandru Popescu


Constructor Summary
protected Assert()
          Protect constructor since it is a static only class
 
Method Summary
static voidassertEquals(boolean actual, boolean expected)
          Asserts that two booleans are equal.
static voidassertEquals(boolean actual, boolean expected, String message)
          Asserts that two booleans are equal.
static voidassertEquals(byte[] actual, byte[] expected)
          Asserts that two arrays contain the same elements in the same order.
static voidassertEquals(byte[] actual, byte[] expected, String message)
          Asserts that two arrays contain the same elements in the same order.
static voidassertEquals(byte actual, byte expected)
          Asserts that two bytes are equal.
static voidassertEquals(byte actual, byte expected, String message)
          Asserts that two bytes are equal.
static voidassertEquals(char actual, char expected)
          Asserts that two chars are equal.
static voidassertEquals(char actual, char expected, String message)
          Asserts that two chars are equal.
static voidassertEquals(Collection actual, Collection expected)
          Asserts that two collections contain the same elements in the same order.
static voidassertEquals(Collection actual, Collection expected, String message)
          Asserts that two collections contain the same elements in the same order.
static voidassertEquals(double actual, double expected, double delta)
          Asserts that two doubles are equal concerning a delta.
static voidassertEquals(double actual, double expected, double delta, String message)
          Asserts that two doubles are equal concerning a delta.
static voidassertEquals(float actual, float expected, float delta)
          Asserts that two floats are equal concerning a delta.
static voidassertEquals(float actual, float expected, float delta, String message)
          Asserts that two floats are equal concerning a delta.
static voidassertEquals(int actual, int expected)
          Asserts that two ints are equal.
static voidassertEquals(int actual, int expected, String message)
          Asserts that two ints are equal.
static voidassertEquals(long actual, long expected)
          Asserts that two longs are equal.
static voidassertEquals(long actual, long expected, String message)
          Asserts that two longs are equal.
static voidassertEquals(Map<?,?> actual, Map<?,?> expected)
          Asserts that two maps are equal.
static voidassertEquals(Object[] actual, Object[] expected)
          Asserts that two arrays contain the same elements in the same order.
static voidassertEquals(Object[] actual, Object[] expected, String message)
          Asserts that two arrays contain the same elements in the same order.
static voidassertEquals(Object actual, Object expected)
          Asserts that two objects are equal.
static voidassertEquals(Object actual, Object expected, String message)
          Asserts that two objects are equal.
static voidassertEquals(Set<?> actual, Set<?> expected, String message)
          Assert set equals
static voidassertEquals(Set actual, Set expected)
          Asserts that two sets are equal.
static voidassertEquals(short actual, short expected)
          Asserts that two shorts are equal.
static voidassertEquals(short actual, short expected, String message)
          Asserts that two shorts are equal.
static voidassertEquals(String actual, String expected)
          Asserts that two Strings are equal.
static voidassertEquals(String actual, String expected, String message)
          Asserts that two Strings are equal.
static voidassertEqualsNoOrder(Object[] actual, Object[] expected)
          Asserts that two arrays contain the same elements in no particular order.
static voidassertEqualsNoOrder(Object[] actual, Object[] expected, String message)
          Asserts that two arrays contain the same elements in no particular order.
static voidassertFalse(boolean condition)
          Asserts that a condition is false.
static voidassertFalse(boolean condition, String message)
          Asserts that a condition is false.
static voidassertNotEquals(double actual1, double actual2, double delta)
           
static voidassertNotEquals(double actual1, double actual2, double delta, String message)
           
static voidassertNotEquals(float actual1, float actual2, float delta)
           
static voidassertNotEquals(float actual1, float actual2, float delta, String message)
           
static voidassertNotEquals(Object actual1, Object actual2)
           
static voidassertNotEquals(Object actual1, Object actual2, String message)
           
static voidassertNotNull(Object object)
          Asserts that an object isn't null.
static voidassertNotNull(Object object, String message)
          Asserts that an object isn't null.
static voidassertNotSame(Object actual, Object expected)
          Asserts that two objects do not refer to the same object.
static voidassertNotSame(Object actual, Object expected, String message)
          Asserts that two objects do not refer to the same objects.
static voidassertNull(Object object)
          Asserts that an object is null.
static voidassertNull(Object object, String message)
          Asserts that an object is null.
static voidassertSame(Object actual, Object expected)
          Asserts that two objects refer to the same object.
static voidassertSame(Object actual, Object expected, String message)
          Asserts that two objects refer to the same object.
static voidassertTrue(boolean condition)
          Asserts that a condition is true.
static voidassertTrue(boolean condition, String message)
          Asserts that a condition is true.
static voidfail()
          Fails a test with no message.
static voidfail(String message)
          Fails a test with the given message.
static voidfail(String message, Throwable realCause)
          Fails a test with the given message and wrapping the original exception.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Assert

protected Assert()
Protect constructor since it is a static only class

Method Detail

assertTrue

public static void assertTrue(boolean condition,                              String message)
Asserts that a condition is true. If it isn't, an AssertionError, with the given message, is thrown.

Parameters:
condition - the condition to evaluate
message - the assertion error message

assertTrue

public static void assertTrue(boolean condition)
Asserts that a condition is true. If it isn't, an AssertionError is thrown.

Parameters:
condition - the condition to evaluate

assertFalse

public static void assertFalse(boolean condition,                               String message)
Asserts that a condition is false. If it isn't, an AssertionError, with the given message, is thrown.

Parameters:
condition - the condition to evaluate
message - the assertion error message

assertFalse

public static void assertFalse(boolean condition)
Asserts that a condition is false. If it isn't, an AssertionError is thrown.

Parameters:
condition - the condition to evaluate

fail

public static void fail(String message,                        Throwable realCause)
Fails a test with the given message and wrapping the original exception.

Parameters:
message - the assertion error message
realCause - the original exception

fail

public static void fail(String message)
Fails a test with the given message.

Parameters:
message - the assertion error message

fail

public static void fail()
Fails a test with no message.


assertEquals

public static void assertEquals(Object actual,                                Object expected,                                String message)
Asserts that two objects are equal. If they are not, an AssertionError, with the given message, is thrown.

Parameters:
actual - the actual value
expected - the expected value
message - the assertion error message

assertEquals

public static void assertEquals(Object actual,                                Object expected)
Asserts that two objects are equal. If they are not, an AssertionError is thrown.

Parameters:
actual - the actual value
expected - the expected value

assertEquals

public static void assertEquals(String actual,                                String expected,                                String message)
Asserts that two Strings are equal. If they are not, an AssertionError, with the given message, is thrown.

Parameters:
actual - the actual value
expected - the expected value
message - the assertion error message

assertEquals

public static void assertEquals(String actual,                                String expected)
Asserts that two Strings are equal. If they are not, an AssertionError is thrown.

Parameters:
actual - the actual value
expected - the expected value

assertEquals

public static void assertEquals(double actual,                                double expected,                                double delta,                                String message)
Asserts that two doubles are equal concerning a delta. If they are not, an AssertionError, with the given message, is thrown. If the expected value is infinity then the delta value is ignored.

Parameters:
actual - the actual value
expected - the expected value
delta - the absolute tolerate value value between the actual and expected value
message - the assertion error message

assertEquals

public static void assertEquals(double actual,                                double expected,                                double delta)
Asserts that two doubles are equal concerning a delta. If they are not, an AssertionError is thrown. If the expected value is infinity then the delta value is ignored.

Parameters:
actual - the actual value
expected - the expected value
delta - the absolute tolerate value value between the actual and expected value

assertEquals

public static void assertEquals(float actual,                                float expected,                                float delta,                                String message)
Asserts that two floats are equal concerning a delta. If they are not, an AssertionError, with the given message, is thrown. If the expected value is infinity then the delta value is ignored.

Parameters:
actual - the actual value
expected - the expected value
delta - the absolute tolerate value value between the actual and expected value
message - the assertion error message

assertEquals

public static void assertEquals(float actual,                                float expected,                                float delta)
Asserts that two floats are equal concerning a delta. If they are not, an AssertionError is thrown. If the expected value is infinity then the delta value is ignored.

Parameters:
actual - the actual value
expected - the expected value
delta - the absolute tolerate value value between the actual and expected value

assertEquals

public static void assertEquals(long actual,                                long expected,                                String message)
Asserts that two longs are equal. If they are not, an AssertionError, with the given message, is thrown.

Parameters:
actual - the actual value
expected - the expected value
message - the assertion error message

assertEquals

public static void assertEquals(long actual,                                long expected)
Asserts that two longs are equal. If they are not, an AssertionError is thrown.

Parameters:
actual - the actual value
expected - the expected value

assertEquals

public static void assertEquals(boolean actual,                                boolean expected,                                String message)
Asserts that two booleans are equal. If they are not, an AssertionError, with the given message, is thrown.

Parameters:
actual - the actual value
expected - the expected value
message - the assertion error message

assertEquals

public static void assertEquals(boolean actual,                                boolean expected)
Asserts that two booleans are equal. If they are not, an AssertionError is thrown.

Parameters:
actual - the actual value
expected - the expected value

assertEquals

public static void assertEquals(byte actual,                                byte expected,                                String message)
Asserts that two bytes are equal. If they are not, an AssertionError, with the given message, is thrown.

Parameters:
actual - the actual value
expected - the expected value
message - the assertion error message

assertEquals

public static void assertEquals(byte actual,                                byte expected)
Asserts that two bytes are equal. If they are not, an AssertionError is thrown.

Parameters:
actual - the actual value
expected - the expected value

assertEquals

public static void assertEquals(char actual,                                char expected,                                String message)
Asserts that two chars are equal. If they are not, an AssertionFailedError, with the given message, is thrown.

Parameters:
actual - the actual value
expected - the expected value
message - the assertion error message

assertEquals

public static void assertEquals(char actual,                                char expected)
Asserts that two chars are equal. If they are not, an AssertionError is thrown.

Parameters:
actual - the actual value
expected - the expected value

assertEquals

public static void assertEquals(short actual,                                short expected,                                String message)
Asserts that two shorts are equal. If they are not, an AssertionFailedError, with the given message, is thrown.

Parameters:
actual - the actual value
expected - the expected value
message - the assertion error message

assertEquals

public static void assertEquals(short actual,                                short expected)
Asserts that two shorts are equal. If they are not, an AssertionError is thrown.

Parameters:
actual - the actual value
expected - the expected value

assertEquals

public static void assertEquals(int actual,                                int expected,                                String message)
Asserts that two ints are equal. If they are not, an AssertionFailedError, with the given message, is thrown.

Parameters:
actual - the actual value
expected - the expected value
message - the assertion error message

assertEquals

public static void assertEquals(int actual,                                int expected)
Asserts that two ints are equal. If they are not, an AssertionError is thrown.

Parameters:
actual - the actual value
expected - the expected value

assertNotNull

public static void assertNotNull(Object object)
Asserts that an object isn't null. If it is, an AssertionError is thrown.

Parameters:
object - the assertion object

assertNotNull

public static void assertNotNull(Object object,                                 String message)
Asserts that an object isn't null. If it is, an AssertionFailedError, with the given message, is thrown.

Parameters:
object - the assertion object
message - the assertion error message

assertNull

public static void assertNull(Object object)
Asserts that an object is null. If it is not, an AssertionError, with the given message, is thrown.

Parameters:
object - the assertion object

assertNull

public static void assertNull(Object object,                              String message)
Asserts that an object is null. If it is not, an AssertionFailedError, with the given message, is thrown.

Parameters:
object - the assertion object
message - the assertion error message

assertSame

public static void assertSame(Object actual,                              Object expected,                              String message)
Asserts that two objects refer to the same object. If they do not, an AssertionFailedError, with the given message, is thrown.

Parameters:
actual - the actual value
expected - the expected value
message - the assertion error message

assertSame

public static void assertSame(Object actual,                              Object expected)
Asserts that two objects refer to the same object. If they do not, an AssertionError is thrown.

Parameters:
actual - the actual value
expected - the expected value

assertNotSame

public static void assertNotSame(Object actual,                                 Object expected,                                 String message)
Asserts that two objects do not refer to the same objects. If they do, an AssertionError, with the given message, is thrown.

Parameters:
actual - the actual value
expected - the expected value
message - the assertion error message

assertNotSame

public static void assertNotSame(Object actual,                                 Object expected)
Asserts that two objects do not refer to the same object. If they do, an AssertionError is thrown.

Parameters:
actual - the actual value
expected - the expected value

assertEquals

public static void assertEquals(Collection actual,                                Collection expected)
Asserts that two collections contain the same elements in the same order. If they do not, an AssertionError is thrown.

Parameters:
actual - the actual value
expected - the expected value

assertEquals

public static void assertEquals(Collection actual,                                Collection expected,                                String message)
Asserts that two collections contain the same elements in the same order. If they do not, an AssertionError, with the given message, is thrown.

Parameters:
actual - the actual value
expected - the expected value
message - the assertion error message

assertEquals

public static void assertEquals(Object[] actual,                                Object[] expected,                                String message)
Asserts that two arrays contain the same elements in the same order. If they do not, an AssertionError, with the given message, is thrown.

Parameters:
actual - the actual value
expected - the expected value
message - the assertion error message

assertEqualsNoOrder

public static void assertEqualsNoOrder(Object[] actual,                                       Object[] expected,                                       String message)
Asserts that two arrays contain the same elements in no particular order. If they do not, an AssertionError, with the given message, is thrown.

Parameters:
actual - the actual value
expected - the expected value
message - the assertion error message

assertEquals

public static void assertEquals(Object[] actual,                                Object[] expected)
Asserts that two arrays contain the same elements in the same order. If they do not, an AssertionError is thrown.

Parameters:
actual - the actual value
expected - the expected value

assertEqualsNoOrder

public static void assertEqualsNoOrder(Object[] actual,                                       Object[] expected)
Asserts that two arrays contain the same elements in no particular order. If they do not, an AssertionError is thrown.

Parameters:
actual - the actual value
expected - the expected value

assertEquals

public static void assertEquals(byte[] actual,                                byte[] expected)
Asserts that two arrays contain the same elements in the same order. If they do not, an AssertionError is thrown.

Parameters:
actual - the actual value
expected - the expected value

assertEquals

public static void assertEquals(byte[] actual,                                byte[] expected,                                String message)
Asserts that two arrays contain the same elements in the same order. If they do not, an AssertionError, with the given message, is thrown.

Parameters:
actual - the actual value
expected - the expected value
message - the assertion error message

assertEquals

public static void assertEquals(Set actual,                                Set expected)
Asserts that two sets are equal.


assertEquals

public static void assertEquals(Set<?> actual,                                Set<?> expected,                                String message)
Assert set equals


assertEquals

public static void assertEquals(Map<?,?> actual,                                Map<?,?> expected)
Asserts that two maps are equal.


assertNotEquals

public static void assertNotEquals(Object actual1,                                   Object actual2,                                   String message)

assertNotEquals

public static void assertNotEquals(Object actual1,                                   Object actual2)

assertNotEquals

public static void assertNotEquals(float actual1,                                   float actual2,                                   float delta,                                   String message)

assertNotEquals

public static void assertNotEquals(float actual1,                                   float actual2,                                   float delta)

assertNotEquals

public static void assertNotEquals(double actual1,                                   double actual2,                                   double delta,                                   String message)

assertNotEquals

public static void assertNotEquals(double actual1,                                   double actual2,                                   double delta)


Copyright © 2012. All Rights Reserved.


NOTHING
NOTHING
Add the Maven Dependecy to your project: maven dependecy for com.amazonaws : aws-java-sdk : 1.3.14