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:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanbooleanaddAll(Collection<?> mocks) private HashSet<HashCodeAndEqualsMockWrapper> asWrappedMocks(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()private <T> T[]unwrapTo(T[] array) Methods inherited from interface Collection
parallelStream, removeIf, streamMethods inherited from interface Set
spliterator
-
Field Details
-
backingHashSet
-
-
Constructor Details
-
HashCodeAndEqualsSafeSet
public HashCodeAndEqualsSafeSet()
-
-
Method Details
-
iterator
-
size
-
isEmpty
-
contains
-
add
-
remove
-
clear
-
clone
- Overrides:
clonein classObject- Throws:
CloneNotSupportedException
-
equals
-
hashCode
-
toArray
-
toArray
-
unwrapTo
private <T> T[] unwrapTo(T[] array) -
removeAll
-
containsAll
- Specified by:
containsAllin interfaceCollection<Object>- Specified by:
containsAllin interfaceSet<Object>
-
addAll
-
retainAll
-
asWrappedMocks
-
toString
-
of
-
of
-