Interface AddLastContract<E,C extends SequencedCollection<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:
ListContract<E,
,L> SequencedCollectionContract<E,
C>
public interface AddLastContract<E,C extends SequencedCollection<E>>
extends CollectionContractSupport<E,C>
This interface tests if a class has implemented the addLast()
method correctly based upon the specification in the
SequencedCollection
class. This contract class can be used individually by a test class, but it is normally used
through the SequencedCollectionContract
class:
public class MyCollectionTest extends SequencedCollectionContract<Integer, MyCollection<Integer>> {
}
If a test is using the SequencedCollectionContract class, but the class being tested does not implement the addLast
method based upon the specification in the SequencedCollection
class, then it can be omitted from the tests using the
doesNotSupportMethod()
method:
public class MyCollectionTest extends SequencedCollectionContract<Integer, MyCollection<Integer>> {
public MyCollectionTest() {
doesNotSupportMethod(CollectionMethods.AddLast);
}
}
- Since:
- 1.0
- Author:
- evanbergstrom
- See Also:
-
Field Summary
Fields inherited from interface org.soliscode.test.contract.support.CollectionContractSupport
DEFAULT_SIZE
-
Method Summary
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
-
testAddLast
@DisplayName("Test that the addLast method adds elements to the end of the collection") @Test default void testAddLast()Tests that the addLast method adds elements to the end of the collection.- Throws:
org.opentest4j.AssertionFailedError
- if the test fails.- See Also:
-
testAddLastWithNullValue
@DisplayName("Test that the addFirst method works with null element values") @Test default void testAddLastWithNullValue()Tests that the addFirst method handles null values correctly.- Throws:
org.opentest4j.AssertionFailedError
- if the test fails.- See Also:
-
addLastWithDuplicateValue
@DisplayName("Test that the addFirst method works with duplicate element values") @Test default void addLastWithDuplicateValue()Tests that the addFirst method handles duplicate values correctly.- Throws:
org.opentest4j.AssertionFailedError
- if the test fails.- See Also:
-