Language

MoreAsserts.CheckEqualsAndHashCodeMethods Method

Definition

Overloads

Name Description
CheckEqualsAndHashCodeMethods(Object, Object, Boolean)

Variant of checkEqualsAndHashCodeMethods(String,Object,Object,boolean.

CheckEqualsAndHashCodeMethods(String, Object, Object, Boolean)

Utility for testing equals() and hashCode() results at once.

CheckEqualsAndHashCodeMethods(Object, Object, Boolean)

Variant of checkEqualsAndHashCodeMethods(String,Object,Object,boolean.

[Android.Runtime.Register("checkEqualsAndHashCodeMethods", "(Ljava/lang/Object;Ljava/lang/Object;Z)V", "")]
public static void CheckEqualsAndHashCodeMethods(Java.Lang.Object? lhs, Java.Lang.Object? rhs, bool expectedResult);
[<Android.Runtime.Register("checkEqualsAndHashCodeMethods", "(Ljava/lang/Object;Ljava/lang/Object;Z)V", "")>]
static member CheckEqualsAndHashCodeMethods : Java.Lang.Object * Java.Lang.Object * bool -> unit

Parameters

lhs
Object

The first object whose Java equality and hash-code methods are tested, or null.

rhs
Object

The second object whose Java equality and hash-code methods are tested, or null.

expectedResult
Boolean

true if equality must hold in both directions and the hash codes must match; false if equality must fail in both directions, without checking hash codes. Two null references require true; exactly one null reference requires false.

Attributes

Remarks

Variant of checkEqualsAndHashCodeMethods(String,Object,Object,boolean...)} using a generic message.

Java documentation for android.test.MoreAsserts.checkEqualsAndHashCodeMethods(java.lang.Object, java.lang.Object, boolean).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

CheckEqualsAndHashCodeMethods(String, Object, Object, Boolean)

Utility for testing equals() and hashCode() results at once.

[Android.Runtime.Register("checkEqualsAndHashCodeMethods", "(Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;Z)V", "")]
public static void CheckEqualsAndHashCodeMethods(string? message, Java.Lang.Object? lhs, Java.Lang.Object? rhs, bool expectedResult);
[<Android.Runtime.Register("checkEqualsAndHashCodeMethods", "(Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;Z)V", "")>]
static member CheckEqualsAndHashCodeMethods : string * Java.Lang.Object * Java.Lang.Object * bool -> unit

Parameters

message
String

The message to include if an equality or hash-code assertion fails, or null for the default message.

lhs
Object

An Object for which equals() and hashCode() are to be tested.

rhs
Object

As lhs.

expectedResult
Boolean

True if the objects should compare equal, false if not.

Attributes

Remarks

Utility for testing equals() and hashCode() results at once. Tests that lhs.equals(rhs) matches expectedResult, as well as rhs.equals(lhs). Also tests that hashCode() return values are equal if expectedResult is true. (hashCode() is not tested if expectedResult is false, as unequal objects can have equal hashCodes.)

Java documentation for android.test.MoreAsserts.checkEqualsAndHashCodeMethods(java.lang.String, java.lang.Object, java.lang.Object, boolean).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to