Class HashCodeAndEqualsSafeSet
java.lang.Object
org.mockito.internal.util.collections.HashCodeAndEqualsSafeSet
hashCode and equals safe hash based set.
Useful for holding mocks that have un-stubbable hashCode or equals method,
meaning that in this scenario the real code is always called and will most probably
cause an NullPointerException.
This collection wraps the mock in an augmented type HashCodeAndEqualsMockWrapper
that have his own implementation.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanbooleanaddAll(Collection<?> mocks) voidclear()clone()booleanbooleancontainsAll(Collection<?> mocks) booleaninthashCode()booleanisEmpty()iterator()static HashCodeAndEqualsSafeSetstatic HashCodeAndEqualsSafeSetbooleanbooleanremoveAll(Collection<?> mocks) booleanretainAll(Collection<?> mocks) intsize()Object[]toArray()<T> T[]toArray(T[] typedArray) toString()Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArrayMethods inherited from interface java.util.Set
spliterator
-
Constructor Details
-
HashCodeAndEqualsSafeSet
public HashCodeAndEqualsSafeSet()
-
-
Method Details
-
iterator
-
size
public int size() -
isEmpty
public boolean isEmpty() -
contains
-
add
-
remove
-
clear
public void clear() -
clone
- Overrides:
clonein classObject- Throws:
CloneNotSupportedException
-
equals
-
hashCode
public int hashCode() -
toArray
-
toArray
public <T> T[] toArray(T[] typedArray) -
removeAll
-
containsAll
- Specified by:
containsAllin interfaceCollection<Object>- Specified by:
containsAllin interfaceSet<Object>
-
addAll
-
retainAll
-
toString
-
of
-
of
-