Class TestInbox

java.lang.Object
com.hazelcast.jet.core.test.TestInbox
All Implemented Interfaces:
Inbox, Iterable<Object>

public final class TestInbox extends Object implements Inbox
Inbox implementation suitable to be used in tests.
Since:
Jet 3.0
  • Constructor Details

    • TestInbox

      public TestInbox()
      Constructs the inbox.
    • TestInbox

      public TestInbox(Collection<?> collection)
      Convenience for new TestInbox().queue().addAll(o)
  • Method Details

    • isEmpty

      public boolean isEmpty()
      Description copied from interface: Inbox
      Returns true if this inbox contains no elements, false otherwise.
      Specified by:
      isEmpty in interface Inbox
    • peek

      public Object peek()
      Description copied from interface: Inbox
      Retrieves, but does not remove, the head of this inbox, or returns null if it is empty.
      Specified by:
      peek in interface Inbox
    • poll

      public Object poll()
      Description copied from interface: Inbox
      Retrieves and removes the head of this inbox, or returns null if it is empty.
      Specified by:
      poll in interface Inbox
    • remove

      public void remove()
      Description copied from interface: Inbox
      Removes the head of this inbox. This method throws an exception if the inbox is empty.
      Specified by:
      remove in interface Inbox
    • queue

      public Deque<Object> queue()
      Retrieves the queue backing the inbox.
    • add

      public void add(Object o)
      Convenience for inbox.queue().add(o)
    • addAll

      public void addAll(Collection<?> collection)
      Convenience for inbox.queue().addAll(collection)
    • iterator

      @Nonnull public Iterator<Object> iterator()
      Description copied from interface: Inbox
      Returns an iterator over the items in the inbox in the order they would be returned by the Inbox.poll() method.

      The returned iterator doesn't support the Iterator.remove() method.

      Specified by:
      iterator in interface Inbox
      Specified by:
      iterator in interface Iterable<Object>
    • clear

      public void clear()
      Convenience for inbox.queue().clear()
      Specified by:
      clear in interface Inbox
    • size

      public int size()
      Convenience for inbox.queue().size()
      Specified by:
      size in interface Inbox
    • toString

      public String toString()
      Overrides:
      toString in class Object