public final class AssertDataObjects extends Object
DataObject
s.
This compares two DataObject
s using their Object.equals(Object)
methods, but
prepares a view of their contents in text form which allows easy comparison of the expected and
actual values using the thrown ComparisonFailure
.
The syntax used happens to be valid Xtend code, and as such could be directly copy/pasted into an *.xtend source file of an expected object definition. This is optional though; this utility can very well be used with any object, not necessarily created by Xtend source code.
This also works for any Java object that is not a DataObject
,
like the AssertBeans
which this is based upon.
for more background
Modifier and Type | Method and Description |
---|---|
static void |
assertEqualBeans(Object expected,
Object actual)
Assert that an actual YANG DataObject (DataContainer) is equals to an expected one.
|
public static void assertEqualBeans(Object expected, Object actual) throws org.junit.ComparisonFailure
The argument types are intentionally of type Object instead of YANG DataContainer or DataObject. This is important so that this can be directly used on e.g. a List or Map etc. of DataObjects.
expected
- the expected objectactual
- the actual object to check against expected
org.junit.ComparisonFailure
AssertBeans.assertEqualBeans(Object, Object)
Copyright © 2019 OpenDaylight. All rights reserved.