Fix invalid tests 60/73760/1
authorRobert Varga <robert.varga@pantheon.tech>
Wed, 4 Jul 2018 18:06:00 +0000 (20:06 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Wed, 4 Jul 2018 18:38:31 +0000 (20:38 +0200)
Generated unions are enforcing length/range of included types,
which means unit tests which use illegal values need to be fixed
up.

Change-Id: Ieb6ff3b2dca42cef5f104ac976e1e54835fba06c
JIRA: MDSAL-360
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
bgp/openconfig-api/src/test/java/org/opendaylight/yang/gen/v1/http/openconfig/net/yang/bgp/types/rev151009/BgpStdCommunityTypeBuilderTest.java
rsvp/spi/src/test/java/org/opendaylight/protocol/rsvp/parser/spi/subobjects/CommonPathKeyParserTest.java

index b8e81c1bd6253341887bf3f60589cb35a22d629b..1b4cdbaa31c6fc39945418a65d968b5a82e0f63c 100644 (file)
@@ -21,8 +21,8 @@ public class BgpStdCommunityTypeBuilderTest {
 
     @Test
     public void testUint32() {
-        final BgpStdCommunityType commType = BgpStdCommunityTypeBuilder.getDefaultInstance("123");
-        Assert.assertEquals(123L, commType.getUint32().longValue());
+        final BgpStdCommunityType commType = BgpStdCommunityTypeBuilder.getDefaultInstance("123456");
+        Assert.assertEquals(123456L, commType.getUint32().longValue());
     }
 
     @Test(expected=IllegalArgumentException.class)
index d7bd64f567c06df80d9ed42526a02f3ce2b1c4e0..d1566332442f3d45b714eb5b1aa283c23cb2c4c8 100644 (file)
@@ -20,7 +20,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.explicit.route.subobjects.subobject.type.path.key._case.PathKeyBuilder;
 
 public class CommonPathKeyParserTest {
-    private final byte[] bytes = new byte[]{0, 1, 2, 3};
+    private final byte[] bytes = new byte[]{0, 1, 2, 3, 4, 5};
     private PathKey key1;
     private PathKey key2;
     private PathKey key3;
@@ -33,7 +33,7 @@ public class CommonPathKeyParserTest {
             .build();
         this.key3 = new PathKeyBuilder().setPathKey(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns
             .yang.rsvp.rev150820.PathKey(1))
-            .setPceId(new PceId(new byte[]{2, 3}))
+            .setPceId(new PceId(new byte[]{2, 3, 4, 5}))
             .build();
     }
 
@@ -55,6 +55,6 @@ public class CommonPathKeyParserTest {
 
     @Test
     public void testParsing() {
-        assertEquals(this.key3, CommonPathKeyParser.parsePathKey(2, Unpooled.copiedBuffer(this.bytes)));
+        assertEquals(this.key3, CommonPathKeyParser.parsePathKey(4, Unpooled.copiedBuffer(this.bytes)));
     }
 }