com.espertech.esper.client.scopetest
Class EPAssertionUtil

java.lang.Object
  extended by com.espertech.esper.client.scopetest.EPAssertionUtil

public class EPAssertionUtil
extends java.lang.Object

Assertion methods for event processing applications.


Nested Class Summary
static interface EPAssertionUtil.AssertionCollectionValueString
          Callback for extracting individual collection items for assertion.
 
Constructor Summary
EPAssertionUtil()
           
 
Method Summary
static void assertAllBooleanTrue(java.lang.Object[] objects)
          Asserts that all values in the given object array are boolean-typed values and are true
static void assertAllPropsSortedByName(EventBean received, java.lang.Object[] expected)
          Asserts that the property values of a single event, using property names as provided by the event type in sorted order by property name, match against the expected values.
static void assertContains(java.lang.String[] stringSet, java.lang.String... values)
          Assert that a string set does contain each of one or more values.
static void assertEqualsAllowArray(java.lang.String message, java.lang.Object expected, java.lang.Object actual)
          Assert that two property values are the same, allowing arrays as properties.
static void assertEqualsAnyOrder(EventBean[][] expected, EventBean[][] actual)
          Compare two 2-dimensional event arrays.
static void assertEqualsAnyOrder(int[] expected, int[] actual)
          Compare the two integer arrays allowing any order.
static void assertEqualsAnyOrder(int[] expected, java.util.Set<java.lang.Integer> actual)
          Assert that each integer value in the expected array is contained in the actual array.
static void assertEqualsAnyOrder(java.lang.Object[] expected, java.lang.Object[] actual)
          Compare the two object arrays allowing any order.
static void assertEqualsExactOrder(boolean[] expected, boolean[] actual)
          Compare the boolean values in the two bool arrays assuming the exact same order.
static void assertEqualsExactOrder(java.util.Collection<java.lang.Object[]> actual, java.lang.String[] propertyNames, java.lang.Object[][] expected)
          Compare the collection of object arrays, and using property names for messages, against expected values.
static void assertEqualsExactOrder(EventBean[] expected, java.util.Iterator<EventBean> actual)
          Compare the iterator-returned events against the expected events
static void assertEqualsExactOrder(int[] expected, int[] actual)
          Compare the integer values in the two int arrays assuming the exact same order.
static void assertEqualsExactOrder(int[] expected, java.lang.Integer[] actual)
          Compare the integer values in the two int arrays assuming the exact same order.
static void assertEqualsExactOrder(long[] expected, long[] actual)
          Compare the long values in the long arrays assuming the exact same order.
static void assertEqualsExactOrder(java.lang.Object[][] expected, java.util.List<java.lang.Object[]> actual)
          Compare the objects in the 2-dimension object arrays assuming the exact same order.
static void assertEqualsExactOrder(java.lang.Object[][] actual, java.lang.String[] propertyNames, java.lang.Object[][] expected)
          Compare two 2-dimensional arrays, and using property names for messages, against expected values.
static void assertEqualsExactOrder(java.lang.Object[] expected, java.util.Collection actual)
          Compare the objects in the expected arrays and actual collection assuming the exact same order.
static void assertEqualsExactOrder(java.lang.Object[] expected, java.util.Iterator actual)
          Compare the objects returned by the iterator to the an object array.
static void assertEqualsExactOrder(java.lang.Object[] expected, java.lang.Object[] actual)
          Compare the objects in the two object arrays assuming the exact same order.
static void assertEqualsExactOrder(short[] expected, short[] actual)
          Compare the short values in the two short arrays assuming the exact same order.
static void assertEqualsExactOrder(java.lang.String[][] expected, java.lang.String[][] actual)
          Deep compare two 2-dimensional string arrays for the exact same length of arrays and order.
static void assertEqualsExactOrder(java.lang.String[] expected, java.lang.String[] actual)
          Compare the String values in the two String arrays assuming the exact same order.
static void assertEqualsExactOrder(java.lang.String message, java.lang.Object[] expected, java.lang.Object[] actual)
          Compare the objects in the two object arrays assuming the exact same order.
static void assertEqualsExactOrderUnderlying(java.lang.Object[] expected, EventBean[] actual)
          Comparing the underlying events to the expected events using equals-semantics.
static void assertEqualsExactOrderUnderlying(java.lang.Object[] expected, java.util.Iterator<EventBean> actual)
          Compare the underlying events returned by the iterator to the expected values.
static void assertEqualsIgnoreNewline(java.lang.String expected, java.lang.String received)
          Compare two strings removing all newline characters.
static void assertMapOfCollection(java.util.Map map, java.lang.String[] keys, java.lang.String[] expectedList, EPAssertionUtil.AssertionCollectionValueString collectionValue)
          Assert that a map of collections (Map) has expected keys and values.
static void assertNotContains(java.lang.String[] stringSet, java.lang.String... values)
          Assert that a string set does not contain one or more values.
static void assertProps(EventBean received, java.util.Map<java.lang.String,java.lang.Object> expected)
          Assert that the event properties of the event match the properties provided by the map, taking the map properties as the comparison source.
static void assertProps(EventBean received, java.lang.String[] propertyNames, java.lang.Object[] expected)
          Assert that the property values of a single event match the expected values.
static void assertProps(java.lang.Object received, java.lang.String[] propertyNames, java.lang.Object[] expected)
          Assert that property values, wherein the row can either be a Map or a POJO object, matches the expected values.
static void assertProps(UniformPair<EventBean> received, java.lang.String[] propertyNames, java.lang.Object[] expectedInsert, java.lang.Object[] expectedRemoved)
          Assert that the property values of a new event and a removed event match the expected insert and removed values.
static void assertPropsAllValuesSame(EventBean received, java.lang.String[] propertyNames, java.lang.Object expected)
          Assert that all properties of an event have the same value as passed in.
static void assertPropsMap(java.util.Map received, java.lang.String[] propertyNames, java.lang.Object... expected)
          Compare the values of a Map against the expected values.
static void assertPropsObjectArray(java.lang.Object[] received, java.lang.String[] propertyNames, java.lang.Object... expected)
          Compare the values of a object array (single row) against the expected values.
static void assertPropsPerRow(EventBean[] received, java.util.List<java.util.Map<java.lang.String,java.lang.Object>> expected)
          Compare properties of events against a list of maps.
static void assertPropsPerRow(EventBean[] received, java.lang.String[] propertyNames, java.lang.Object[][] expected)
          Compare the property values of events with the expected values, using exact-order semantics.
static void assertPropsPerRow(EventBean[] actual, java.lang.String[] propertyNames, java.lang.Object[][] expected, java.lang.String streamName)
          Compare the property values of events with the expected values, using exact-order semantics.
static void assertPropsPerRow(java.util.Iterator<EventBean> iterator, java.util.List<java.util.Map<java.lang.String,java.lang.Object>> expected)
          Compare properties of events against a list of maps.
static void assertPropsPerRow(java.util.Iterator<EventBean> iterator, SafeIterator<EventBean> safeIterator, java.lang.String[] propertyNames, java.lang.Object[][] expected)
          Compare the property values returned by events of both iterators with the expected values, using exact-order semantics.
static void assertPropsPerRow(java.util.Iterator<EventBean> iterator, java.lang.String[] propertyNames, java.lang.Object[][] expected)
          Compare the property values returned by events of both iterators with the expected values, using exact-order semantics.
static void assertPropsPerRow(java.util.List<java.lang.Object[]> received, java.lang.String[] propertyNames, java.lang.Object[][] expected)
          Assert that property values of rows, wherein each row can either be Map or POJO objects, matches the expected values.
static void assertPropsPerRow(java.util.Map[] actual, java.lang.String[] propertyNames, java.lang.Object[][] expected)
          Compare the Map values identified by property names against expected values.
static void assertPropsPerRow(java.lang.Object[] received, java.lang.String[] propertyNames, java.lang.Object[][] expected)
          Assert that property values of rows, wherein each row can either be Map or POJO objects, matches the expected values.
static void assertPropsPerRow(UniformPair<EventBean[]> received, java.lang.String[] propertyNames, java.lang.Object[][] expectedInsert, java.lang.Object[][] expectedRemoved)
          Assert that the property values of a new event and a removed event match the expected insert and removed values.
static void assertPropsPerRow(UniformPair<EventBean[]> received, java.lang.String propertyName, java.lang.Object[] expectedInsert, java.lang.Object[] expectedRemoved)
          Assert that the property values of the events (insert and remove pair) match the expected insert and removed values for a single property.
static void assertPropsPerRowAnyOrder(EventBean[] actual, java.lang.String[] propertyNames, java.lang.Object[][] expected)
          Compare the property values of events with the expected values, using any-order semantics.
static void assertPropsPerRowAnyOrder(java.util.Iterator<EventBean> iterator, SafeIterator<EventBean> safeIterator, java.lang.String[] propertyNames, java.lang.Object[][] expected)
          Compare the property values returned by events of both iterators with the expected values, using any-order semantics.
static void assertPropsPerRowAnyOrder(java.util.Iterator<EventBean> iterator, java.lang.String[] propertyNames, java.lang.Object[][] expected)
          Compare the property values returned by events of the iterator with the expected values, using any-order semantics.
static void assertPropsPerRowAnyOrder(SafeIterator<EventBean> safeIterator, java.lang.String[] propertyNames, java.lang.Object[][] expected)
          Compare the property values returned by events of the iterator with the expected values, using any-order semantics.
static void assertPropsPOJO(java.lang.Object received, java.lang.String[] propertyNames, java.lang.Object... expected)
          Compare the properties of an object against the expected values.
static void assertSameAnyOrder(java.lang.Object[][] expected, java.lang.Object[][] actual)
          Compare two 2-dimensional object arrays using reference-equals semantics.
static void assertSameExactOrder(java.lang.Object[] expected, java.lang.Object[] actual)
          Reference-equals the objects in the two object arrays assuming the exact same order.
static void assertTypeEqualsAnyOrder(java.lang.Class[] classes, java.lang.Object[] objects)
          Assert the class of the objects in the object array matches the expected classes in the classes array.
static void assertUnderlyingPerRow(UniformPair<EventBean[]> received, java.lang.Object[] expectedUnderlyingInsert, java.lang.Object[] expectedUnderlyingRemove)
          Assert that the underlying objects of the events (insert and remove pair) match the expected insert and removed objects.
static boolean compareEqualsExactOrder(EventBean[] actual, EventBean[] expected)
          Compare the events in the two object arrays assuming the exact same order.
static boolean compareRefExactOrder(java.lang.Object[] actual, java.lang.Object[] expected)
          Reference-compare the objects in the two object arrays assuming the exact same order.
static java.lang.Object[] concatenateArray(java.lang.Object[]... more)
          Concatenate multiple arrays.
static java.lang.Object[] concatenateArray(java.lang.Object[] srcOne, java.lang.Object[] srcTwo)
          Concatenate two arrays.
static java.lang.Object[][] concatenateArray2Dim(java.lang.Object[][] first, java.lang.Object[][]... more)
          Concatenate two arrays.
static java.lang.Object[] eventsToObjectArr(EventBean[] events, java.lang.String propertyName)
          Extract the property value of the event property for the given events and return an object array of values.
static java.lang.Object[][] eventsToObjectArr(EventBean[] events, java.lang.String[] propertyNames)
          Extract the property value of the event properties for the given events and return an object array of values.
static java.lang.Object[] getUnderlying(EventBean[] events)
          Return an array of underlying objects for an array of events.
static
<T> int
iteratorCount(java.util.Iterator<T> iterator)
          Count the number of object provided by an iterator.
static EventBean[] iteratorToArray(java.util.Iterator<EventBean> iterator)
          Convert an iterator of event beans to an array of event beans.
static java.lang.Object[] iteratorToArrayUnderlying(java.util.Iterator<EventBean> iterator)
          Convert an iterator of event beans to an array of underlying objects.
static java.lang.Object[] iteratorToObjectArr(java.util.Iterator<EventBean> iterator, java.lang.String propertyName)
          Extract the property value of the event property for the given events and return an object array of values.
static java.lang.Object[][] iteratorToObjectArr(java.util.Iterator<EventBean> iterator, java.lang.String[] propertyNames)
          Extract the property value of the event properties for the given events and return an object array of values.
static EventBean[] sort(EventBean[] events, java.lang.String property)
          Sort events according to natural ordering of the values or a property.
static EventBean[] sort(java.util.Iterator<EventBean> events, java.lang.String property)
          Sort events according to natural ordering of the values or a property.
static java.lang.Object[] toObjectArray(java.lang.Object array)
          For a given array, copy the array elements into a new array of Object[] type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EPAssertionUtil

public EPAssertionUtil()
Method Detail

assertEqualsExactOrder

public static void assertEqualsExactOrder(java.lang.String[][] expected,
                                          java.lang.String[][] actual)
Deep compare two 2-dimensional string arrays for the exact same length of arrays and order.

Parameters:
expected - is the expected values
actual - is the actual values

assertEqualsExactOrder

public static void assertEqualsExactOrder(java.lang.Object[][] actual,
                                          java.lang.String[] propertyNames,
                                          java.lang.Object[][] expected)
Compare two 2-dimensional arrays, and using property names for messages, against expected values.

Parameters:
actual - array of objects
propertyNames - property names
expected - expected values

assertEqualsExactOrder

public static void assertEqualsExactOrder(java.util.Collection<java.lang.Object[]> actual,
                                          java.lang.String[] propertyNames,
                                          java.lang.Object[][] expected)
Compare the collection of object arrays, and using property names for messages, against expected values.

Parameters:
actual - colleciton of array of objects
propertyNames - property names
expected - expected values

assertEqualsExactOrder

public static void assertEqualsExactOrder(EventBean[] expected,
                                          java.util.Iterator<EventBean> actual)
Compare the iterator-returned events against the expected events

Parameters:
expected - is the expected values
actual - is the actual values

assertEqualsExactOrderUnderlying

public static void assertEqualsExactOrderUnderlying(java.lang.Object[] expected,
                                                    java.util.Iterator<EventBean> actual)
Compare the underlying events returned by the iterator to the expected values.

Parameters:
expected - is the expected values
actual - is the actual values

assertEqualsExactOrderUnderlying

public static void assertEqualsExactOrderUnderlying(java.lang.Object[] expected,
                                                    EventBean[] actual)
Comparing the underlying events to the expected events using equals-semantics.

Parameters:
expected - is the expected values
actual - is the actual values

assertEqualsExactOrder

public static void assertEqualsExactOrder(java.lang.Object[][] expected,
                                          java.util.List<java.lang.Object[]> actual)
Compare the objects in the 2-dimension object arrays assuming the exact same order.

Parameters:
expected - is the expected values
actual - is the actual values

assertEqualsExactOrder

public static void assertEqualsExactOrder(java.lang.Object[] expected,
                                          java.lang.Object[] actual)
Compare the objects in the two object arrays assuming the exact same order.

Parameters:
expected - is the expected values
actual - is the actual values

assertEqualsExactOrder

public static void assertEqualsExactOrder(java.lang.String message,
                                          java.lang.Object[] expected,
                                          java.lang.Object[] actual)
Compare the objects in the two object arrays assuming the exact same order.

Parameters:
expected - is the expected values
actual - is the actual values
message - an optional message that can be output when assrtion fails

assertEqualsExactOrder

public static void assertEqualsExactOrder(java.lang.Object[] expected,
                                          java.util.Collection actual)
Compare the objects in the expected arrays and actual collection assuming the exact same order.

Parameters:
expected - is the expected values
actual - is the actual values

assertSameExactOrder

public static void assertSameExactOrder(java.lang.Object[] expected,
                                        java.lang.Object[] actual)
Reference-equals the objects in the two object arrays assuming the exact same order.

Parameters:
expected - is the expected values
actual - is the actual values

assertEqualsExactOrder

public static void assertEqualsExactOrder(int[] expected,
                                          int[] actual)
Compare the integer values in the two int arrays assuming the exact same order.

Parameters:
expected - is the expected values
actual - is the actual values

assertEqualsExactOrder

public static void assertEqualsExactOrder(int[] expected,
                                          java.lang.Integer[] actual)
Compare the integer values in the two int arrays assuming the exact same order.

Parameters:
expected - is the expected values
actual - is the actual values

assertEqualsExactOrder

public static void assertEqualsExactOrder(short[] expected,
                                          short[] actual)
Compare the short values in the two short arrays assuming the exact same order.

Parameters:
expected - is the expected values
actual - is the actual values

assertEqualsExactOrder

public static void assertEqualsExactOrder(long[] expected,
                                          long[] actual)
Compare the long values in the long arrays assuming the exact same order.

Parameters:
expected - is the expected values
actual - is the actual values

assertEqualsExactOrder

public static void assertEqualsExactOrder(java.lang.String[] expected,
                                          java.lang.String[] actual)
Compare the String values in the two String arrays assuming the exact same order.

Parameters:
expected - is the expected values
actual - is the actual values

assertEqualsExactOrder

public static void assertEqualsExactOrder(boolean[] expected,
                                          boolean[] actual)
Compare the boolean values in the two bool arrays assuming the exact same order.

Parameters:
expected - is the expected values
actual - is the actual values

assertEqualsExactOrder

public static void assertEqualsExactOrder(java.lang.Object[] expected,
                                          java.util.Iterator actual)
Compare the objects returned by the iterator to the an object array.

Parameters:
expected - is the expected values
actual - is the actual values

assertEqualsAnyOrder

public static void assertEqualsAnyOrder(int[] expected,
                                        java.util.Set<java.lang.Integer> actual)
Assert that each integer value in the expected array is contained in the actual array.

Parameters:
expected - is the expected values
actual - is the actual values

assertEqualsAnyOrder

public static void assertEqualsAnyOrder(int[] expected,
                                        int[] actual)
Compare the two integer arrays allowing any order.

Parameters:
expected - is the expected values
actual - is the actual values

assertEqualsAnyOrder

public static void assertEqualsAnyOrder(java.lang.Object[] expected,
                                        java.lang.Object[] actual)
Compare the two object arrays allowing any order.

Parameters:
expected - is the expected values
actual - is the actual values

assertPropsPerRow

public static void assertPropsPerRow(java.util.Iterator<EventBean> iterator,
                                     SafeIterator<EventBean> safeIterator,
                                     java.lang.String[] propertyNames,
                                     java.lang.Object[][] expected)
Compare the property values returned by events of both iterators with the expected values, using exact-order semantics.

Parameters:
iterator - provides events
safeIterator - provides events
propertyNames - array of property names
expected - expected values

assertPropsPerRowAnyOrder

public static void assertPropsPerRowAnyOrder(java.util.Iterator<EventBean> iterator,
                                             SafeIterator<EventBean> safeIterator,
                                             java.lang.String[] propertyNames,
                                             java.lang.Object[][] expected)
Compare the property values returned by events of both iterators with the expected values, using any-order semantics.

Parameters:
iterator - provides events
safeIterator - provides events
propertyNames - array of property names
expected - expected values

assertPropsPerRowAnyOrder

public static void assertPropsPerRowAnyOrder(SafeIterator<EventBean> safeIterator,
                                             java.lang.String[] propertyNames,
                                             java.lang.Object[][] expected)
Compare the property values returned by events of the iterator with the expected values, using any-order semantics.

Parameters:
safeIterator - provides events
propertyNames - array of property names
expected - expected values

assertPropsPerRowAnyOrder

public static void assertPropsPerRowAnyOrder(java.util.Iterator<EventBean> iterator,
                                             java.lang.String[] propertyNames,
                                             java.lang.Object[][] expected)
Compare the property values returned by events of the iterator with the expected values, using any-order semantics.

Parameters:
iterator - provides events
propertyNames - array of property names
expected - expected values

assertPropsPerRow

public static void assertPropsPerRow(java.util.Iterator<EventBean> iterator,
                                     java.lang.String[] propertyNames,
                                     java.lang.Object[][] expected)
Compare the property values returned by events of both iterators with the expected values, using exact-order semantics.

Parameters:
iterator - provides events
propertyNames - array of property names
expected - expected values

assertPropsPerRow

public static void assertPropsPerRow(java.util.Map[] actual,
                                     java.lang.String[] propertyNames,
                                     java.lang.Object[][] expected)
Compare the Map values identified by property names against expected values.

Parameters:
actual - array of Maps, one for each row
propertyNames - property names
expected - expected values

assertPropsPerRow

public static void assertPropsPerRow(EventBean[] received,
                                     java.lang.String[] propertyNames,
                                     java.lang.Object[][] expected)
Compare the property values of events with the expected values, using exact-order semantics.

Parameters:
received - provides events
propertyNames - array of property names
expected - expected values

assertPropsPerRow

public static void assertPropsPerRow(EventBean[] actual,
                                     java.lang.String[] propertyNames,
                                     java.lang.Object[][] expected,
                                     java.lang.String streamName)
Compare the property values of events with the expected values, using exact-order semantics.

Parameters:
actual - provides events
propertyNames - array of property names
expected - expected values
streamName - an optional name for the stream for use in messages

assertPropsPerRowAnyOrder

public static void assertPropsPerRowAnyOrder(EventBean[] actual,
                                             java.lang.String[] propertyNames,
                                             java.lang.Object[][] expected)
Compare the property values of events with the expected values, using any-order semantics.

Parameters:
actual - provides events
propertyNames - array of property names
expected - expected values

assertProps

public static void assertProps(EventBean received,
                               java.lang.String[] propertyNames,
                               java.lang.Object[] expected)
Assert that the property values of a single event match the expected values.

Parameters:
received - provides events
propertyNames - array of property names
expected - expected values

assertProps

public static void assertProps(UniformPair<EventBean> received,
                               java.lang.String[] propertyNames,
                               java.lang.Object[] expectedInsert,
                               java.lang.Object[] expectedRemoved)
Assert that the property values of a new event and a removed event match the expected insert and removed values.

Parameters:
received - provides events
propertyNames - array of property names
expectedInsert - expected values insert stream
expectedRemoved - expected values remove stream

assertPropsPerRow

public static void assertPropsPerRow(UniformPair<EventBean[]> received,
                                     java.lang.String[] propertyNames,
                                     java.lang.Object[][] expectedInsert,
                                     java.lang.Object[][] expectedRemoved)
Assert that the property values of a new event and a removed event match the expected insert and removed values.

Parameters:
received - provides events
propertyNames - array of property names
expectedInsert - expected values insert stream
expectedRemoved - expected values remove stream

assertPropsPerRow

public static void assertPropsPerRow(UniformPair<EventBean[]> received,
                                     java.lang.String propertyName,
                                     java.lang.Object[] expectedInsert,
                                     java.lang.Object[] expectedRemoved)
Assert that the property values of the events (insert and remove pair) match the expected insert and removed values for a single property.

Parameters:
received - provides events
propertyName - property name
expectedInsert - expected values insert stream
expectedRemoved - expected values remove stream

assertUnderlyingPerRow

public static void assertUnderlyingPerRow(UniformPair<EventBean[]> received,
                                          java.lang.Object[] expectedUnderlyingInsert,
                                          java.lang.Object[] expectedUnderlyingRemove)
Assert that the underlying objects of the events (insert and remove pair) match the expected insert and removed objects.

Parameters:
received - provides events
expectedUnderlyingInsert - expected underlying object insert stream
expectedUnderlyingRemove - expected underlying object remove stream

assertAllPropsSortedByName

public static void assertAllPropsSortedByName(EventBean received,
                                              java.lang.Object[] expected)
Asserts that the property values of a single event, using property names as provided by the event type in sorted order by property name, match against the expected values.

Parameters:
received - provides events
expected - expected values

assertPropsMap

public static void assertPropsMap(java.util.Map received,
                                  java.lang.String[] propertyNames,
                                  java.lang.Object... expected)
Compare the values of a Map against the expected values.

Parameters:
received - provides properties
expected - expected values
propertyNames - property names to assert

assertPropsObjectArray

public static void assertPropsObjectArray(java.lang.Object[] received,
                                          java.lang.String[] propertyNames,
                                          java.lang.Object... expected)
Compare the values of a object array (single row) against the expected values.

Parameters:
received - provides properties
expected - expected values
propertyNames - property names to assert

assertPropsPOJO

public static void assertPropsPOJO(java.lang.Object received,
                                   java.lang.String[] propertyNames,
                                   java.lang.Object... expected)
Compare the properties of an object against the expected values.

Parameters:
propertyNames - property names
received - provides events
expected - expected values

assertEqualsAnyOrder

public static void assertEqualsAnyOrder(EventBean[][] expected,
                                        EventBean[][] actual)
Compare two 2-dimensional event arrays.

Parameters:
expected - expected values
actual - actual values

assertSameAnyOrder

public static void assertSameAnyOrder(java.lang.Object[][] expected,
                                      java.lang.Object[][] actual)
Compare two 2-dimensional object arrays using reference-equals semantics.

Parameters:
expected - expected values
actual - actual values

assertAllBooleanTrue

public static void assertAllBooleanTrue(java.lang.Object[] objects)
Asserts that all values in the given object array are boolean-typed values and are true

Parameters:
objects - values to assert that they are all true

assertTypeEqualsAnyOrder

public static void assertTypeEqualsAnyOrder(java.lang.Class[] classes,
                                            java.lang.Object[] objects)
Assert the class of the objects in the object array matches the expected classes in the classes array.

Parameters:
classes - is the expected class
objects - is the objects to check the class for

iteratorToArray

public static EventBean[] iteratorToArray(java.util.Iterator<EventBean> iterator)
Convert an iterator of event beans to an array of event beans.

Parameters:
iterator - to convert
Returns:
array of events

iteratorToArrayUnderlying

public static java.lang.Object[] iteratorToArrayUnderlying(java.util.Iterator<EventBean> iterator)
Convert an iterator of event beans to an array of underlying objects.

Parameters:
iterator - to convert
Returns:
array of event underlying objects

iteratorCount

public static <T> int iteratorCount(java.util.Iterator<T> iterator)
Count the number of object provided by an iterator.

Type Parameters:
T - type
Parameters:
iterator - to count
Returns:
count

assertPropsPerRow

public static void assertPropsPerRow(EventBean[] received,
                                     java.util.List<java.util.Map<java.lang.String,java.lang.Object>> expected)
Compare properties of events against a list of maps.

Parameters:
received - actual events
expected - expected values

assertPropsPerRow

public static void assertPropsPerRow(java.util.Iterator<EventBean> iterator,
                                     java.util.List<java.util.Map<java.lang.String,java.lang.Object>> expected)
Compare properties of events against a list of maps.

Parameters:
iterator - actual events
expected - expected values

concatenateArray

public static java.lang.Object[] concatenateArray(java.lang.Object[] srcOne,
                                                  java.lang.Object[] srcTwo)
Concatenate two arrays.

Parameters:
srcOne - array to concatenate
srcTwo - array to concatenate
Returns:
concatenated array

concatenateArray2Dim

public static java.lang.Object[][] concatenateArray2Dim(java.lang.Object[][] first,
                                                        java.lang.Object[][]... more)
Concatenate two arrays.

Parameters:
first - array to concatenate
more - array to concatenate
Returns:
concatenated array

concatenateArray

public static java.lang.Object[] concatenateArray(java.lang.Object[]... more)
Concatenate multiple arrays.

Parameters:
more - arrays to concatenate
Returns:
concatenated array

sort

public static EventBean[] sort(java.util.Iterator<EventBean> events,
                               java.lang.String property)
Sort events according to natural ordering of the values or a property.

Parameters:
events - to sort
property - name of property providing sort values
Returns:
sorted array

sort

public static EventBean[] sort(EventBean[] events,
                               java.lang.String property)
Sort events according to natural ordering of the values or a property.

Parameters:
events - to sort
property - name of property providing sort values
Returns:
sorted array

assertNotContains

public static void assertNotContains(java.lang.String[] stringSet,
                                     java.lang.String... values)
Assert that a string set does not contain one or more values.

Parameters:
stringSet - to compare against
values - to find

assertContains

public static void assertContains(java.lang.String[] stringSet,
                                  java.lang.String... values)
Assert that a string set does contain each of one or more values.

Parameters:
stringSet - to compare against
values - to find

getUnderlying

public static java.lang.Object[] getUnderlying(EventBean[] events)
Return an array of underlying objects for an array of events.

Parameters:
events - to return underlying objects
Returns:
events

assertPropsAllValuesSame

public static void assertPropsAllValuesSame(EventBean received,
                                            java.lang.String[] propertyNames,
                                            java.lang.Object expected)
Assert that all properties of an event have the same value as passed in.

Parameters:
received - to inspect
propertyNames - property names
expected - value

eventsToObjectArr

public static java.lang.Object[] eventsToObjectArr(EventBean[] events,
                                                   java.lang.String propertyName)
Extract the property value of the event property for the given events and return an object array of values.

Parameters:
events - to extract value from
propertyName - name of property to extract values for
Returns:
value object array

eventsToObjectArr

public static java.lang.Object[][] eventsToObjectArr(EventBean[] events,
                                                     java.lang.String[] propertyNames)
Extract the property value of the event properties for the given events and return an object array of values.

Parameters:
events - to extract value from
propertyNames - names of properties to extract values for
Returns:
value object array

iteratorToObjectArr

public static java.lang.Object[] iteratorToObjectArr(java.util.Iterator<EventBean> iterator,
                                                     java.lang.String propertyName)
Extract the property value of the event property for the given events and return an object array of values.

Parameters:
iterator - events to extract value from
propertyName - name of property to extract values for
Returns:
value object array

iteratorToObjectArr

public static java.lang.Object[][] iteratorToObjectArr(java.util.Iterator<EventBean> iterator,
                                                       java.lang.String[] propertyNames)
Extract the property value of the event properties for the given events and return an object array of values.

Parameters:
iterator - events to extract value from
propertyNames - names of properties to extract values for
Returns:
value object array

compareEqualsExactOrder

public static boolean compareEqualsExactOrder(EventBean[] actual,
                                              EventBean[] expected)
Compare the events in the two object arrays assuming the exact same order.

Parameters:
actual - is the actual results
expected - is the expected values
Returns:
indicate whether compared successfully

compareRefExactOrder

public static boolean compareRefExactOrder(java.lang.Object[] actual,
                                           java.lang.Object[] expected)
Reference-compare the objects in the two object arrays assuming the exact same order.

Parameters:
actual - is the actual results
expected - is the expected values
Returns:
indicate whether compared successfully

assertPropsPerRow

public static void assertPropsPerRow(java.lang.Object[] received,
                                     java.lang.String[] propertyNames,
                                     java.lang.Object[][] expected)
Assert that property values of rows, wherein each row can either be Map or POJO objects, matches the expected values.

Parameters:
received - array of objects may contain Map and POJO events
propertyNames - property names
expected - expected value

assertPropsPerRow

public static void assertPropsPerRow(java.util.List<java.lang.Object[]> received,
                                     java.lang.String[] propertyNames,
                                     java.lang.Object[][] expected)
Assert that property values of rows, wherein each row can either be Map or POJO objects, matches the expected values.

Parameters:
received - array of objects may contain Map and POJO events
propertyNames - property names
expected - expected value

assertProps

public static void assertProps(java.lang.Object received,
                               java.lang.String[] propertyNames,
                               java.lang.Object[] expected)
Assert that property values, wherein the row can either be a Map or a POJO object, matches the expected values.

Parameters:
received - Map or POJO
propertyNames - property names
expected - expected value

toObjectArray

public static java.lang.Object[] toObjectArray(java.lang.Object array)
For a given array, copy the array elements into a new array of Object[] type.

Parameters:
array - input array
Returns:
object array

assertEqualsAllowArray

public static void assertEqualsAllowArray(java.lang.String message,
                                          java.lang.Object expected,
                                          java.lang.Object actual)
Assert that two property values are the same, allowing arrays as properties.

Parameters:
message - to use
expected - expected value
actual - actual value

assertProps

public static void assertProps(EventBean received,
                               java.util.Map<java.lang.String,java.lang.Object> expected)
Assert that the event properties of the event match the properties provided by the map, taking the map properties as the comparison source.

Parameters:
received - event
expected - expected values

assertEqualsIgnoreNewline

public static void assertEqualsIgnoreNewline(java.lang.String expected,
                                             java.lang.String received)
Compare two strings removing all newline characters.

Parameters:
expected - expected value
received - received value

assertMapOfCollection

public static void assertMapOfCollection(java.util.Map map,
                                         java.lang.String[] keys,
                                         java.lang.String[] expectedList,
                                         EPAssertionUtil.AssertionCollectionValueString collectionValue)
Assert that a map of collections (Map) has expected keys and values.

Parameters:
map - of string keys and collection-type values
keys - array of key values
expectedList - for each key a string that is a comma-separated list of values
collectionValue - the function to apply to each collection value to convert to a string

© 2006-2015 EsperTech Inc.
All rights reserved.
Visit us at espertech.com