org.gcube.data.streams.test
Class FallibleIterator<E>

java.lang.Object
  extended by org.gcube.data.streams.test.FallibleIterator<E>
Type Parameters:
E - the type of stream elements
All Implemented Interfaces:
Iterator<E>

public class FallibleIterator<E>
extends Object
implements Iterator<E>

An Iterator that can be staged to throw faults as well as elements. Used for testing purposes.

Author:
Fabio Simeoni

Constructor Summary
FallibleIterator(Class<E> clazz, List<? extends Object> elements)
          Creates an instance with a given type of the elements and given actual elements.
 
Method Summary
 boolean hasNext()
           
 E next()
           
 void remove()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FallibleIterator

public FallibleIterator(Class<E> clazz,
                        List<? extends Object> elements)
                 throws IllegalArgumentException
Creates an instance with a given type of the elements and given actual elements.

Parameters:
clazz - the type of elements
elements - the actual elements, including RuntimeExceptions
Throws:
IllegalArgumentException - if the elements are neither RuntimeExceptions nor have the declared type.
Method Detail

hasNext

public boolean hasNext()
Specified by:
hasNext in interface Iterator<E>

next

public E next()
Specified by:
next in interface Iterator<E>

remove

public void remove()
Specified by:
remove in interface Iterator<E>


Copyright © 2012. All Rights Reserved.