com.emarsys.ecommon.test.testng
Class IteratorHelper<T>
java.lang.Object
com.emarsys.ecommon.test.testng.IteratorHelper<T>
public class IteratorHelper<T>
- extends java.lang.Object
Helper class for dealing with Iterator
s in TestNG unit
test cases.
- Author:
- Michael "kULO" Kulovits
Constructor Summary |
IteratorHelper(java.lang.Iterable<T> it)
|
IteratorHelper(java.lang.Iterable<T> it,
java.lang.Class<? extends java.lang.Exception> expectedExceptionClass)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
IteratorHelper
public IteratorHelper(java.lang.Iterable<T> it)
- Parameters:
it
-
IteratorHelper
public IteratorHelper(java.lang.Iterable<T> it,
java.lang.Class<? extends java.lang.Exception> expectedExceptionClass)
assertEquals
public static <T> void assertEquals(java.util.Iterator<T> expected,
java.util.Iterator<T> actual)
- Asserts (using the test-ng
Assert
class) that the
passed Iterator
s represent the same element sequence,
i.e. that their iteration will result in the same elements
retrieved.
- Type Parameters:
T
- - Parameters:
expected
- actual
-
assertEquals
public static <T> void assertEquals(java.util.Iterator<T> expected,
java.util.Iterator<T> actual,
java.util.Comparator<T> comp)
isExpectErrors
public boolean isExpectErrors()
- Returns:
- the expectErrors
getIterable
public java.lang.Iterable<T> getIterable()
- Returns:
- the iterable
getIterator
public java.util.Iterator<T> getIterator()
- Returns:
- the iterator
iterate
public void iterate(IteratorHelper.IteratorFunctor<T> func)
throws java.lang.Exception
- Parameters:
func
-
- Throws:
java.lang.Exception
list
public static <T> java.util.List<T> list(java.util.Iterator<T> it)
- Type Parameters:
T
- - Parameters:
it
-
- Returns:
Copyright © 2010 emarsys AG. All Rights Reserved.