Class Breakables

java.lang.Object
org.soliscode.test.breakable.Breakables

public final class Breakables extends Object
Utility class for creating breakable objects for testing contract classes.
Since:
1.0
Author:
evanbergstrom
  • Method Details

    • buildIterable

      public static <E> BreakableIterable.Builder<E> buildIterable(Class<E> c)
      Creates a builder for a BreakableIterable.
      Type Parameters:
      E - the type of the elements.
      Parameters:
      c - the class of the element for the iterable.
      Returns:
      a builder.
    • buildIterable

      @SafeVarargs public static <E> BreakableIterable.Builder<E> buildIterable(E... e)
      Creates a builder for a BreakableIterable 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

      public static <E> BreakableCollection.Builder<E> buildCollection(Class<E> c)
      Creates a builder for a BreakableCollection.
      Type Parameters:
      E - the type of the elements.
      Parameters:
      c - the class of the element for the collection.
      Returns:
      a builder.
    • buildCollection

      @SafeVarargs public static <E> BreakableCollection.Builder<E> buildCollection(E... e)
      Creates a builder for a BreakableCollection 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

      public static <E> BreakableSequencedCollection.Builder<E> buildSequencedCollection(Class<E> c)
      Creates a builder for a BreakableSequencedCollection.
      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 a BreakableSequencedCollection 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

      public static <E> Iterable<E> ensureUnbroken(@NotNull @NotNull Iterable<E> i)
      Makes sure that the iterator is not a broken iterator. If the argument is an instance of BreakableIterator then the underlying iterator used as the element store is returned.
      Parameters:
      i - an instance of iterator.
      Returns:
      an unbroken iterator.
    • ensureUnbroken

      public static <E> Collection<E> ensureUnbroken(@NotNull @NotNull Collection<E> i)
      Makes sure that the collection is not a broken collection. If the argument is an instance of BreakableCollection then the underlying collection used as the element store is returned.
      Parameters:
      i - an instance of collection.
      Returns:
      an unbroken collection.