Class Breakables
java.lang.Object
org.soliscode.test.breakable.Breakables
Utility class for creating breakable objects for testing contract classes.
- Since:
- 1.0
- Author:
- evanbergstrom
-
Method Summary
Modifier and TypeMethodDescriptionstatic <E> BreakableCollection.Builder
<E> buildCollection
(E... e) Creates a builder for aBreakableCollection
initialized with a set of elements.static <E> BreakableCollection.Builder
<E> buildCollection
(Class<E> c) Creates a builder for aBreakableCollection
.static <E> BreakableIterable.Builder
<E> buildIterable
(E... e) Creates a builder for aBreakableIterable
initialized with a set of elements.static <E> BreakableIterable.Builder
<E> buildIterable
(Class<E> c) Creates a builder for aBreakableIterable
.static <E> BreakableSequencedCollection.Builder
<E> buildSequencedCollection
(E... e) Creates a builder for aBreakableSequencedCollection
initialized with a set of elements.static <E> BreakableSequencedCollection.Builder
<E> Creates a builder for aBreakableSequencedCollection
.static <E> Iterable
<E> ensureUnbroken
(@NotNull Iterable<E> i) Makes sure that the iterator is not a broken iterator.static <E> Collection
<E> ensureUnbroken
(@NotNull Collection<E> i) Makes sure that the collection is not a broken collection.
-
Method Details
-
buildIterable
Creates a builder for aBreakableIterable
.- Type Parameters:
E
- the type of the elements.- Parameters:
c
- the class of the element for the iterable.- Returns:
- a builder.
-
buildIterable
Creates a builder for aBreakableIterable
initialized with a set of elements.- Type Parameters:
E
- the type of the elements.- Parameters:
e
- the elements to add to the iterable.- Returns:
- a builder.
-
buildCollection
Creates a builder for aBreakableCollection
.- Type Parameters:
E
- the type of the elements.- Parameters:
c
- the class of the element for the collection.- Returns:
- a builder.
-
buildCollection
Creates a builder for aBreakableCollection
initialized with a set of elements.- Type Parameters:
E
- the type of the elements.- Parameters:
e
- the elements to add to the collection.- Returns:
- a builder.
-
buildSequencedCollection
Creates a builder for aBreakableSequencedCollection
.- Type Parameters:
E
- the type of the elements.- Parameters:
c
- the class of the element for the collection.- Returns:
- a builder.
-
buildSequencedCollection
@SafeVarargs public static <E> BreakableSequencedCollection.Builder<E> buildSequencedCollection(E... e) Creates a builder for aBreakableSequencedCollection
initialized with a set of elements.- Type Parameters:
E
- the type of the elements.- Parameters:
e
- the elements to add to the collection.- Returns:
- a builder.
-
ensureUnbroken
Makes sure that the iterator is not a broken iterator. If the argument is an instance ofBreakableIterator
then the underlying iterator used as the element store is returned.- Parameters:
i
- an instance of iterator.- Returns:
- an unbroken iterator.
-
ensureUnbroken
Makes sure that the collection is not a broken collection. If the argument is an instance ofBreakableCollection
then the underlying collection used as the element store is returned.- Parameters:
i
- an instance of collection.- Returns:
- an unbroken collection.
-