assertSame()

Purpose

Checks that two object are actually the same.

Syntax

assertSame( [<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 the assertSame() method, the test is stopped.

Examples

Object one_obj = new Long(10);

Object other=one_obj;

assertSame("assert Same passed", one_obj,other);

 

Object one_obj = new Long(10);

Object other=one_obj;

assertSame(one_obj,other);

 

Related Topics

assertEquals()verifyEquals()verifySame()