verifySame()

Purpose

Checks that two object are actually the same.

Syntax

verifySame( [<string>],<object1>,<object2> )

where:

Description

The corresponding test result is Passed if <object1> and <object2> refer to the same object, and Failed if the condition is False.

An optional <string> message can be logged and displayed in the test report.

If an exception is thrown in a verifySame() method, an error is logged and the test continues.

Examples

Object one_obj = new Integer(10);

Object another = one_obj;

verifySame("verify same passed",another,one_obj);

 

Object one_obj = new Long(10);

Object other=one_obj;

assertSame(one_obj,other);

 

Related Topics

assertEquals()verifyEquals()assertSame()