Make leafrefFromLeafListToLeafTest impervious to list order 44/23044/2
authorTom Pantelis <tpanteli@brocade.com>
Sat, 20 Jun 2015 09:06:56 +0000 (05:06 -0400)
committerGerrit Code Review <gerrit@opendaylight.org>
Thu, 2 Jul 2015 11:14:34 +0000 (11:14 +0000)
In NnToJsonLeafrefType#leafrefFromLeafListToLeafTest, the leaf list is
unordered but the regex expects a certain order based on the way the
list is currently hashed. But this makes it susceptible to failure if
something changes upstream to alter the order. So I changed the regex to
not depend on the order.

Note: an upcoming yang tools patch will alter the order as a side effect
that affects this test.

Change-Id: Ibf95271b008134c3f75fc99c9ee7ba0d643dfe7a
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/nn/to/json/test/NnToJsonLeafrefType.java

index 65fcc668bc38ab2f11582c58d66131fb3302724d..132b9f1e10695318b3d85c7f5d44af7c0b4ccac4 100644 (file)
@@ -71,7 +71,7 @@ public class NnToJsonLeafrefType extends AbstractBodyReaderTest {
     public void leafrefFromLeafListToLeafTest() throws Exception {
         final String json = toJson("/nn-to-json/leafref/xml/data_relativ_ref_from_leaflist_to_existing_leaf.xml");
         validateJson(
-                ".*\"cont-augment-module\\p{Blank}*:\\p{Blank}*lflst1\":\\p{Blank}*.*\"346\",*\"347\",*\"345\".*",
+                ".*\"cont-augment-module\\p{Blank}*:\\p{Blank}*lflst1\":\\p{Blank}*.*\"34[5|6|7]\",*\"34[5|6|7]\",*\"34[5|6|7]\".*",
                 json);
     }