public final class AssertDataObjects extends Object
DataObject
s.
This compares two DataObject
s by creating a textual representation of them,
and comparing them. If they are not equals, then the thrown ComparisonFailure provides
for a very highly readable comparison due to a syntax which immediately makes the difference obvious.
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.