public class EPAssertionUtil extends Object
Modifier and Type | Class and Description |
---|---|
static interface |
EPAssertionUtil.AssertionCollectionValueString
Callback for extracting individual collection items for assertion.
|
Constructor and Description |
---|
EPAssertionUtil() |
Modifier and Type | Method and Description |
---|---|
static void |
assertAllBooleanTrue(Object[] objects)
Asserts that all values in the given object array are boolean-typed values and are true
|
static void |
assertAllPropsSortedByName(EventBean received,
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(String[] stringSet,
String... values)
Assert that a string set does contain each of one or more values.
|
static void |
assertEqualsAllowArray(String message,
Object expected,
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,
Set<Integer> actual)
Assert that each integer value in the expected array is contained in the actual array.
|
static void |
assertEqualsAnyOrder(Object[] expected,
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(Collection<Object[]> actual,
String[] propertyNames,
Object[][] expected)
Compare the collection of object arrays, and using property names for messages, against expected values.
|
static void |
assertEqualsExactOrder(EventBean[] expected,
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,
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(Object[][] expected,
List<Object[]> actual)
Compare the objects in the 2-dimension object arrays assuming the exact same order.
|
static void |
assertEqualsExactOrder(Object[][] actual,
String[] propertyNames,
Object[][] expected)
Compare two 2-dimensional arrays, and using property names for messages, against expected values.
|
static void |
assertEqualsExactOrder(Object[] expected,
Collection actual)
Compare the objects in the expected arrays and actual collection assuming the exact same order.
|
static void |
assertEqualsExactOrder(Object[] expected,
Iterator actual)
Compare the objects returned by the iterator to the an object array.
|
static void |
assertEqualsExactOrder(Object[] expected,
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(String[][] expected,
String[][] actual)
Deep compare two 2-dimensional string arrays for the exact same length of arrays and order.
|
static void |
assertEqualsExactOrder(String[] expected,
String[] actual)
Compare the String values in the two String arrays assuming the exact same order.
|
static void |
assertEqualsExactOrder(String message,
Object[] expected,
Object[] actual)
Compare the objects in the two object arrays assuming the exact same order.
|
static void |
assertEqualsExactOrderUnderlying(Object[] expected,
EventBean[] actual)
Comparing the underlying events to the expected events using equals-semantics.
|
static void |
assertEqualsExactOrderUnderlying(Object[] expected,
Iterator<EventBean> actual)
Compare the underlying events returned by the iterator to the expected values.
|
static void |
assertEqualsIgnoreNewline(String expected,
String received)
Compare two strings removing all newline characters.
|
static void |
assertMapOfCollection(Map map,
String[] keys,
String[] expectedList,
EPAssertionUtil.AssertionCollectionValueString collectionValue)
Assert that a map of collections (Map<String, Collection>) has expected keys and values.
|
static void |
assertNotContains(String[] stringSet,
String... values)
Assert that a string set does not contain one or more values.
|
static void |
assertProps(EventBean received,
Map<String,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,
String[] propertyNames,
Object[] expected)
Assert that the property values of a single event match the expected values.
|
static void |
assertProps(Object received,
String[] propertyNames,
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,
String[] propertyNames,
Object[] expectedInsert,
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,
String[] propertyNames,
Object expected)
Assert that all properties of an event have the same value as passed in.
|
static void |
assertPropsMap(Map received,
String[] propertyNames,
Object... expected)
Compare the values of a Map against the expected values.
|
static void |
assertPropsObjectArray(Object[] received,
String[] propertyNames,
Object... expected)
Compare the values of a object array (single row) against the expected values.
|
static void |
assertPropsPerRow(EventBean[] received,
List<Map<String,Object>> expected)
Compare properties of events against a list of maps.
|
static void |
assertPropsPerRow(EventBean[] received,
String[] propertyNames,
Object[][] expected)
Compare the property values of events with the expected values, using exact-order semantics.
|
static void |
assertPropsPerRow(EventBean[] actual,
String[] propertyNames,
Object[][] expected,
String streamName)
Compare the property values of events with the expected values, using exact-order semantics.
|
static void |
assertPropsPerRow(Iterator<EventBean> iterator,
List<Map<String,Object>> expected)
Compare properties of events against a list of maps.
|
static void |
assertPropsPerRow(Iterator<EventBean> iterator,
SafeIterator<EventBean> safeIterator,
String[] propertyNames,
Object[][] expected)
Compare the property values returned by events of both iterators with the expected values, using exact-order semantics.
|
static void |
assertPropsPerRow(Iterator<EventBean> iterator,
String[] propertyNames,
Object[][] expected)
Compare the property values returned by events of both iterators with the expected values, using exact-order semantics.
|
static void |
assertPropsPerRow(List<Object[]> received,
String[] propertyNames,
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(Map[] actual,
String[] propertyNames,
Object[][] expected)
Compare the Map values identified by property names against expected values.
|
static void |
assertPropsPerRow(Object[] received,
String[] propertyNames,
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,
String[] propertyNames,
Object[][] expectedInsert,
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,
String propertyName,
Object[] expectedInsert,
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,
String[] propertyNames,
Object[][] expected)
Compare the property values of events with the expected values, using any-order semantics.
|
static void |
assertPropsPerRowAnyOrder(Iterator<EventBean> iterator,
SafeIterator<EventBean> safeIterator,
String[] propertyNames,
Object[][] expected)
Compare the property values returned by events of both iterators with the expected values, using any-order semantics.
|
static void |
assertPropsPerRowAnyOrder(Iterator<EventBean> iterator,
String[] propertyNames,
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,
String[] propertyNames,
Object[][] expected)
Compare the property values returned by events of the iterator with the expected values, using any-order semantics.
|
static void |
assertPropsPerRowAnyOrder(UniformPair<EventBean[]> pair,
String[] propertyNames,
Object[][] expectedNew,
Object[][] expectedOld)
Compare property values for insert and remove stream pair
|
static void |
assertPropsPOJO(Object received,
String[] propertyNames,
Object... expected)
Compare the properties of an object against the expected values.
|
static void |
assertSameAnyOrder(Object[][] expected,
Object[][] actual)
Compare two 2-dimensional object arrays using reference-equals semantics.
|
static void |
assertSameExactOrder(Object[] expected,
Object[] actual)
Reference-equals the objects in the two object arrays assuming the exact same order.
|
static void |
assertTypeEqualsAnyOrder(Class[] classes,
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,
Object[] expectedUnderlyingInsert,
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(Object[] actual,
Object[] expected)
Reference-compare the objects in the two object arrays assuming the exact same order.
|
static Object[] |
concatenateArray(Object[]... more)
Concatenate multiple arrays.
|
static Object[] |
concatenateArray(Object[] srcOne,
Object[] srcTwo)
Concatenate two arrays.
|
static Object[][] |
concatenateArray2Dim(Object[][] first,
Object[][]... more)
Concatenate two arrays.
|
static Object[] |
eventsToObjectArr(EventBean[] events,
String propertyName)
Extract the property value of the event property for the given events and return an object array of values.
|
static Object[][] |
eventsToObjectArr(EventBean[] events,
String[] propertyNames)
Extract the property value of the event properties for the given events and return an object array of values.
|
static Object[] |
getUnderlying(EventBean[] events)
Return an array of underlying objects for an array of events.
|
static <T> int |
iteratorCount(Iterator<T> iterator)
Count the number of object provided by an iterator.
|
static EventBean[] |
iteratorToArray(Iterator<EventBean> iterator)
Convert an iterator of event beans to an array of event beans.
|
static Object[] |
iteratorToArrayUnderlying(Iterator<EventBean> iterator)
Convert an iterator of event beans to an array of underlying objects.
|
static Object[] |
iteratorToObjectArr(Iterator<EventBean> iterator,
String propertyName)
Extract the property value of the event property for the given events and return an object array of values.
|
static Object[][] |
iteratorToObjectArr(Iterator<EventBean> iterator,
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,
String property)
Sort events according to natural ordering of the values or a property.
|
static EventBean[] |
sort(Iterator<EventBean> events,
String property)
Sort events according to natural ordering of the values or a property.
|
static Object[] |
toObjectArray(Object array)
For a given array, copy the array elements into a new array of Object[] type.
|
public static void assertEqualsExactOrder(String[][] expected, String[][] actual)
expected
- is the expected valuesactual
- is the actual valuespublic static void assertEqualsExactOrder(Object[][] actual, String[] propertyNames, Object[][] expected)
actual
- array of objectspropertyNames
- property namesexpected
- expected valuespublic static void assertEqualsExactOrder(Collection<Object[]> actual, String[] propertyNames, Object[][] expected)
actual
- colleciton of array of objectspropertyNames
- property namesexpected
- expected valuespublic static void assertEqualsExactOrder(EventBean[] expected, Iterator<EventBean> actual)
expected
- is the expected valuesactual
- is the actual valuespublic static void assertEqualsExactOrderUnderlying(Object[] expected, Iterator<EventBean> actual)
expected
- is the expected valuesactual
- is the actual valuespublic static void assertEqualsExactOrderUnderlying(Object[] expected, EventBean[] actual)
expected
- is the expected valuesactual
- is the actual valuespublic static void assertEqualsExactOrder(Object[][] expected, List<Object[]> actual)
expected
- is the expected valuesactual
- is the actual valuespublic static void assertEqualsExactOrder(Object[] expected, Object[] actual)
expected
- is the expected valuesactual
- is the actual valuespublic static void assertEqualsExactOrder(String message, Object[] expected, Object[] actual)
expected
- is the expected valuesactual
- is the actual valuesmessage
- an optional message that can be output when assrtion failspublic static void assertEqualsExactOrder(Object[] expected, Collection actual)
expected
- is the expected valuesactual
- is the actual valuespublic static void assertSameExactOrder(Object[] expected, Object[] actual)
expected
- is the expected valuesactual
- is the actual valuespublic static void assertEqualsExactOrder(int[] expected, int[] actual)
expected
- is the expected valuesactual
- is the actual valuespublic static void assertEqualsExactOrder(int[] expected, Integer[] actual)
expected
- is the expected valuesactual
- is the actual valuespublic static void assertEqualsExactOrder(short[] expected, short[] actual)
expected
- is the expected valuesactual
- is the actual valuespublic static void assertEqualsExactOrder(long[] expected, long[] actual)
expected
- is the expected valuesactual
- is the actual valuespublic static void assertEqualsExactOrder(String[] expected, String[] actual)
expected
- is the expected valuesactual
- is the actual valuespublic static void assertEqualsExactOrder(boolean[] expected, boolean[] actual)
expected
- is the expected valuesactual
- is the actual valuespublic static void assertEqualsExactOrder(Object[] expected, Iterator actual)
expected
- is the expected valuesactual
- is the actual valuespublic static void assertEqualsAnyOrder(int[] expected, Set<Integer> actual)
expected
- is the expected valuesactual
- is the actual valuespublic static void assertEqualsAnyOrder(int[] expected, int[] actual)
expected
- is the expected valuesactual
- is the actual valuespublic static void assertEqualsAnyOrder(Object[] expected, Object[] actual)
expected
- is the expected valuesactual
- is the actual valuespublic static void assertPropsPerRow(Iterator<EventBean> iterator, SafeIterator<EventBean> safeIterator, String[] propertyNames, Object[][] expected)
iterator
- provides eventssafeIterator
- provides eventspropertyNames
- array of property namesexpected
- expected valuespublic static void assertPropsPerRowAnyOrder(Iterator<EventBean> iterator, SafeIterator<EventBean> safeIterator, String[] propertyNames, Object[][] expected)
iterator
- provides eventssafeIterator
- provides eventspropertyNames
- array of property namesexpected
- expected valuespublic static void assertPropsPerRowAnyOrder(UniformPair<EventBean[]> pair, String[] propertyNames, Object[][] expectedNew, Object[][] expectedOld)
pair
- pairpropertyNames
- namesexpectedNew
- expected insert-stream valuesexpectedOld
- expected remove-stream valuespublic static void assertPropsPerRowAnyOrder(SafeIterator<EventBean> safeIterator, String[] propertyNames, Object[][] expected)
safeIterator
- provides eventspropertyNames
- array of property namesexpected
- expected valuespublic static void assertPropsPerRowAnyOrder(Iterator<EventBean> iterator, String[] propertyNames, Object[][] expected)
iterator
- provides eventspropertyNames
- array of property namesexpected
- expected valuespublic static void assertPropsPerRow(Iterator<EventBean> iterator, String[] propertyNames, Object[][] expected)
iterator
- provides eventspropertyNames
- array of property namesexpected
- expected valuespublic static void assertPropsPerRow(Map[] actual, String[] propertyNames, Object[][] expected)
actual
- array of Maps, one for each rowpropertyNames
- property namesexpected
- expected valuespublic static void assertPropsPerRow(EventBean[] received, String[] propertyNames, Object[][] expected)
received
- provides eventspropertyNames
- array of property namesexpected
- expected valuespublic static void assertPropsPerRow(EventBean[] actual, String[] propertyNames, Object[][] expected, String streamName)
actual
- provides eventspropertyNames
- array of property namesexpected
- expected valuesstreamName
- an optional name for the stream for use in messagespublic static void assertPropsPerRowAnyOrder(EventBean[] actual, String[] propertyNames, Object[][] expected)
actual
- provides eventspropertyNames
- array of property namesexpected
- expected valuespublic static void assertProps(EventBean received, String[] propertyNames, Object[] expected)
received
- provides eventspropertyNames
- array of property namesexpected
- expected valuespublic static void assertProps(UniformPair<EventBean> received, String[] propertyNames, Object[] expectedInsert, Object[] expectedRemoved)
received
- provides eventspropertyNames
- array of property namesexpectedInsert
- expected values insert streamexpectedRemoved
- expected values remove streampublic static void assertPropsPerRow(UniformPair<EventBean[]> received, String[] propertyNames, Object[][] expectedInsert, Object[][] expectedRemoved)
received
- provides eventspropertyNames
- array of property namesexpectedInsert
- expected values insert streamexpectedRemoved
- expected values remove streampublic static void assertPropsPerRow(UniformPair<EventBean[]> received, String propertyName, Object[] expectedInsert, Object[] expectedRemoved)
received
- provides eventspropertyName
- property nameexpectedInsert
- expected values insert streamexpectedRemoved
- expected values remove streampublic static void assertUnderlyingPerRow(UniformPair<EventBean[]> received, Object[] expectedUnderlyingInsert, Object[] expectedUnderlyingRemove)
received
- provides eventsexpectedUnderlyingInsert
- expected underlying object insert streamexpectedUnderlyingRemove
- expected underlying object remove streampublic static void assertAllPropsSortedByName(EventBean received, Object[] expected)
received
- provides eventsexpected
- expected valuespublic static void assertPropsMap(Map received, String[] propertyNames, Object... expected)
received
- provides propertiesexpected
- expected valuespropertyNames
- property names to assertpublic static void assertPropsObjectArray(Object[] received, String[] propertyNames, Object... expected)
received
- provides propertiesexpected
- expected valuespropertyNames
- property names to assertpublic static void assertPropsPOJO(Object received, String[] propertyNames, Object... expected)
propertyNames
- property namesreceived
- provides eventsexpected
- expected valuespublic static void assertEqualsAnyOrder(EventBean[][] expected, EventBean[][] actual)
expected
- expected valuesactual
- actual valuespublic static void assertSameAnyOrder(Object[][] expected, Object[][] actual)
expected
- expected valuesactual
- actual valuespublic static void assertAllBooleanTrue(Object[] objects)
objects
- values to assert that they are all truepublic static void assertTypeEqualsAnyOrder(Class[] classes, Object[] objects)
classes
- is the expected classobjects
- is the objects to check the class forpublic static EventBean[] iteratorToArray(Iterator<EventBean> iterator)
iterator
- to convertpublic static Object[] iteratorToArrayUnderlying(Iterator<EventBean> iterator)
iterator
- to convertpublic static <T> int iteratorCount(Iterator<T> iterator)
T
- typeiterator
- to countpublic static void assertPropsPerRow(EventBean[] received, List<Map<String,Object>> expected)
received
- actual eventsexpected
- expected valuespublic static void assertPropsPerRow(Iterator<EventBean> iterator, List<Map<String,Object>> expected)
iterator
- actual eventsexpected
- expected valuespublic static Object[] concatenateArray(Object[] srcOne, Object[] srcTwo)
srcOne
- array to concatenatesrcTwo
- array to concatenatepublic static Object[][] concatenateArray2Dim(Object[][] first, Object[][]... more)
first
- array to concatenatemore
- array to concatenatepublic static Object[] concatenateArray(Object[]... more)
more
- arrays to concatenatepublic static EventBean[] sort(Iterator<EventBean> events, String property)
events
- to sortproperty
- name of property providing sort valuespublic static EventBean[] sort(EventBean[] events, String property)
events
- to sortproperty
- name of property providing sort valuespublic static void assertNotContains(String[] stringSet, String... values)
stringSet
- to compare againstvalues
- to findpublic static void assertContains(String[] stringSet, String... values)
stringSet
- to compare againstvalues
- to findpublic static Object[] getUnderlying(EventBean[] events)
events
- to return underlying objectspublic static void assertPropsAllValuesSame(EventBean received, String[] propertyNames, Object expected)
received
- to inspectpropertyNames
- property namesexpected
- valuepublic static Object[] eventsToObjectArr(EventBean[] events, String propertyName)
events
- to extract value frompropertyName
- name of property to extract values forpublic static Object[][] eventsToObjectArr(EventBean[] events, String[] propertyNames)
events
- to extract value frompropertyNames
- names of properties to extract values forpublic static Object[] iteratorToObjectArr(Iterator<EventBean> iterator, String propertyName)
iterator
- events to extract value frompropertyName
- name of property to extract values forpublic static Object[][] iteratorToObjectArr(Iterator<EventBean> iterator, String[] propertyNames)
iterator
- events to extract value frompropertyNames
- names of properties to extract values forpublic static boolean compareEqualsExactOrder(EventBean[] actual, EventBean[] expected)
actual
- is the actual resultsexpected
- is the expected valuespublic static boolean compareRefExactOrder(Object[] actual, Object[] expected)
actual
- is the actual resultsexpected
- is the expected valuespublic static void assertPropsPerRow(Object[] received, String[] propertyNames, Object[][] expected)
received
- array of objects may contain Map and POJO eventspropertyNames
- property namesexpected
- expected valuepublic static void assertPropsPerRow(List<Object[]> received, String[] propertyNames, Object[][] expected)
received
- array of objects may contain Map and POJO eventspropertyNames
- property namesexpected
- expected valuepublic static void assertProps(Object received, String[] propertyNames, Object[] expected)
received
- Map or POJOpropertyNames
- property namesexpected
- expected valuepublic static Object[] toObjectArray(Object array)
array
- input arraypublic static void assertEqualsAllowArray(String message, Object expected, Object actual)
message
- to useexpected
- expected valueactual
- actual valuepublic static void assertProps(EventBean received, Map<String,Object> expected)
received
- eventexpected
- expected valuespublic static void assertEqualsIgnoreNewline(String expected, String received)
expected
- expected valuereceived
- received valuepublic static void assertMapOfCollection(Map map, String[] keys, String[] expectedList, EPAssertionUtil.AssertionCollectionValueString collectionValue)
map
- of string keys and collection-type valueskeys
- array of key valuesexpectedList
- for each key a string that is a comma-separated list of valuescollectionValue
- the function to apply to each collection value to convert to a string