@Connector(name="assert-object-equals",
friendlyName="Assert Object Equals",
description="Compares two Java Map/List based structures)")
@Category(name="org.mule.tooling.category.munit",
description="MUnit")
public class AssertObjectEqualsConnector
extends Object
| Constructor and Description |
|---|
AssertObjectEqualsConnector() |
| Modifier and Type | Method and Description |
|---|---|
Object |
compareObjects(Object expected,
Object actual,
boolean containsOnlyOnMaps,
boolean checkMapOrder,
List<String> pathOptions)
Compare two objects.
|
Object |
compareXml(Object expected,
Object actual,
XmlCompareOption xmlCompareOption)
Compare two XML documents.
|
@Processor(friendlyName="Compare Objects") public Object compareObjects(@FriendlyName(value="Expected value") Object expected, @Default(value="#[payload]") @FriendlyName(value="Actual value") Object actual, @Default(value="false") @FriendlyName(value="Contains only on maps") boolean containsOnlyOnMaps, @Default(value="false") @FriendlyName(value="Check map order") boolean checkMapOrder, @Default(value="#[[]]") @FriendlyName(value="Path patterns+options") List<String> pathOptions) throws Exception
expected - The expected value. Automatic conversions are provided:
trim()actual - The actual value. Automatic conversions are provided:
trim()containsOnlyOnMaps - The actual value entry set of maps can contain more values than the expected set. So you tests do not
fail when there are more elements than expected in the result.checkMapOrder - The order of map entries is checked. The default is to ignore order of map entries.pathOptions - Options for path patterns to control the comparison. Syntax of one List entry: Zero to n
path parts. The parts can have the following syntax:
?: Wildcard one, matches one element in a path*: Wildcard any, matches zero to n elements in a path[#]: List wildcard, matches a list entry with any index[0]: Matches a list entry with the given number. 0 or positive numbers: Count from
beginning, negative number: Cound from end (-1 is last element)['.*']: Matches a map entry where the key must match the given regular expression. If
you need a ' in the expression, just write ''. The example '.*' matches all keys.actual, but converted to Object when it had to be parsed.Exception - When comparison fails or on technical problems (e.g. parsing)@Processor(friendlyName="Compare XML") public Object compareXml(Object expected, @Default(value="#[payload]") Object actual, @Default(value="NORMALIZE_WHITESPACE") @FriendlyName(value="XML compare option") XmlCompareOption xmlCompareOption)
expected - The expected value, XML as String, InputStream, byte[] or DOM tree.actual - The actual value, XML as String, InputStream, byte[] or DOM tree.xmlCompareOption - How to compare the XML documents.
IGNORE_COMMENTS: Will remove all comment-Tags "" from test- and control-XML before
comparing.
IGNORE_WHITESPACE: Ignore whitespace by removing all empty text nodes and trimming the non-empty ones.
NORMALIZE_WHITESPACE: Normalize Text-Elements by removing all empty text nodes and normalizing the
non-empty ones.actualCopyright © 2010–2017. All rights reserved.