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:
  • Method Details

    • testRemoveAllOnEmptyContainer

      @Test @DisplayName("The removeAll method can be called on an empty container") default void testRemoveAllOnEmptyContainer()
      Test that the removeAll method works on an empty container.
    • testRemoveAllOnContainerWithElements

      @Test @DisplayName("The removeAll method works on a container with elements") default void testRemoveAllOnContainerWithElements()
      Test that the removeAll method works on a container with elements.
    • testRemoveAllOnNullElement

      @Test @DisplayName("The removeAll method works with null elements") default void testRemoveAllOnNullElement()
      Tests that the removeAll method works with incompatible objects.
    • testRemoveAllOnIncompatibleObject

      @Test @DisplayName("The removeAll method works with incompatible types") default void testRemoveAllOnIncompatibleObject()
      Tests that the removeAll 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 an IllegalArgumentException here, so either exception type is accepted.