Interface RemoveAllContract<E,C extends Collection<E>>
- Type Parameters:
E
- The element type being tested.C
- The collection type being tested.
- All Superinterfaces:
CollectionContractConfig
,CollectionContractSupport<E,
,C> CollectionProviderSupport<E,
,C> ContractSupport<C>
,ElementProviderSupport<E>
,ProviderSupport<C>
,SupportedMethods
- All Known Subinterfaces:
CollectionContract<E,
,C> ListContract<E,
,L> SequencedCollectionContract<E,
C>
public interface RemoveAllContract<E,C extends Collection<E>>
extends CollectionContractSupport<E,C>
This interface tests if a collection class has implemented the
removeAll
method correctly.- Since:
- 1.0
- Author:
- evanbergstrom
- See Also:
-
Field Summary
Fields inherited from interface org.soliscode.test.contract.support.CollectionContractSupport
DEFAULT_SIZE
-
Method Summary
Modifier and TypeMethodDescriptiondefault void
Test that theremoveAll
method works on a container with elements.default void
Test that theremoveAll
method works on an empty container.default void
Tests that theremoveAll
method works with incompatible objects.default void
Tests that theremoveAll
method works with incompatible objects.default void
Tests that theremoveAll
method throws on a null collection.Methods inherited from interface org.soliscode.test.contract.CollectionContractConfig
permitDuplicates, permitIncompatibleTypes, permitNulls
Methods inherited from interface org.soliscode.test.contract.support.CollectionProviderSupport
provider
Methods inherited from interface org.soliscode.test.contract.support.ElementProviderSupport
elementProvider
Methods inherited from interface org.soliscode.test.SupportedMethods
supportsMethod
-
Method Details
-
testRemoveAllOnEmptyContainer
@Test @DisplayName("The removeAll method can be called on an empty container") default void testRemoveAllOnEmptyContainer()Test that theremoveAll
method works on an empty container. -
testRemoveAllOnContainerWithElements
@Test @DisplayName("The removeAll method works on a container with elements") default void testRemoveAllOnContainerWithElements()Test that theremoveAll
method works on a container with elements. -
testRemoveAllOnNullElement
@Test @DisplayName("The removeAll method works with null elements") default void testRemoveAllOnNullElement()Tests that theremoveAll
method works with incompatible objects. -
testRemoveAllOnIncompatibleObject
@Test @DisplayName("The removeAll method works with incompatible types") default void testRemoveAllOnIncompatibleObject()Tests that theremoveAll
method works with incompatible objects. -
testRemoveAllThrowsOnNullCollection
@Test @DisplayName("The removeAll method throws on a null collection") default void testRemoveAllThrowsOnNullCollection()Tests that the
removeAll
method throws on a null collection.Implementation Notes
This test checks that the
removeAll
function throws the correct exception if it is called on a null value. IntelliJ will detect a problem when it is called with a null argument since the method declaration has a NotNull annotation. Since this is what we are trying to test, the inspection is suppressed here.Any implementations that use the
NotNull
annotation for the collection parameter may throw anIllegalArgumentException
here, so either exception type is accepted.
-