Add utility converters
[yangtools.git] / yang / yang-common / src / test / java / org / opendaylight / yangtools / yang / common / Uint32Test.java
index 81716a14e28f5608923cd4c5f2808cf0369b2736..2706dc0e842c09d09e017b8e1c7ec2fd03a32688 100644 (file)
@@ -95,6 +95,20 @@ public class Uint32Test {
 
         assertSame(Uint32.valueOf(5), Uint32.valueOf(UnsignedInteger.fromIntBits(5)));
         assertEquals(UnsignedInteger.fromIntBits(5), Uint32.valueOf(5).toGuava());
+
+        assertEquals(Uint8.TEN, Uint32.TEN.toUint8());
+        assertEquals(Uint16.TEN, Uint32.TEN.toUint16());
+        assertEquals(Uint64.valueOf(4294967295L), Uint32.MAX_VALUE.toUint64());
+    }
+
+    @Test(expected = IllegalArgumentException.class)
+    public void testToUint8() {
+        Uint32.MAX_VALUE.toUint8();
+    }
+
+    @Test(expected = IllegalArgumentException.class)
+    public void testToUint16() {
+        Uint32.MAX_VALUE.toUint16();
     }
 
     @Test