HashCodeAndEqualsMockWrapper
Date: 2015-09-18

org.mockito.internal.util.collections

## Class HashCodeAndEqualsMockWrapper

- java.lang.Object
- - org.mockito.internal.util.collections.HashCodeAndEqualsMockWrapper

-     public class HashCodeAndEqualsMockWrapper
      extends java.lang.Object

  hashCode and equals safe mock wrapper.

  It doesn't use the actual mock `Object.hashCode()` and `Object.equals(java.lang.Object)` method as they might throw an NPE if those method cannot be stubbed even internally.

  Instead the strategy is :

  - For hashCode : use `System.identityHashCode(java.lang.Object)`
  - For equals : use the object reference equality
  See Also:
    `HashCodeAndEqualsSafeSet`

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `HashCodeAndEqualsMockWrapper(java.lang.Object mockInstance)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `equals(java.lang.Object o)`
    `java.lang.Object` | `get()`
    `int` | `hashCode()`
    `static HashCodeAndEqualsMockWrapper` | `of(java.lang.Object mock)`
    `java.lang.String` | `toString()`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### HashCodeAndEqualsMockWrapper

          public HashCodeAndEqualsMockWrapper(java.lang.Object mockInstance)

  - ### Method Detail

    - #### get

          public java.lang.Object get()

    - #### equals

          public boolean equals(java.lang.Object o)

      Overrides:
        `equals` in class `java.lang.Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `java.lang.Object`

    - #### of

          public static HashCodeAndEqualsMockWrapper of(java.lang.Object mock)

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `java.lang.Object`