Fix Decima64.valueOf(String)
[yangtools.git] / yang / yang-common / src / test / java / org / opendaylight / yangtools / yang / common / RevisionTest.java
index 2a433142b3edb03dfd2a98deba8b475b311e75c3..47c81cd7f5eb079331f352cba420eeeed6829f1d 100644 (file)
@@ -9,6 +9,7 @@ package org.opendaylight.yangtools.yang.common;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertThrows;
 import static org.junit.Assert.assertTrue;
 
 import java.io.ByteArrayInputStream;
@@ -26,34 +27,34 @@ public class RevisionTest {
         assertEquals("2017-12-25", Revision.of("2017-12-25").toString());
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void testOfNull() {
-        Revision.of(null);
+        assertThrows(NullPointerException.class, () -> Revision.of(null));
     }
 
-    @Test(expected = DateTimeParseException.class)
+    @Test
     public void testOfEmpty() {
-        Revision.of("");
+        assertThrows(DateTimeParseException.class, () -> Revision.of(""));
     }
 
-    @Test(expected = DateTimeParseException.class)
+    @Test
     public void testOfInvalid() {
-        Revision.of("invalid");
+        assertThrows(DateTimeParseException.class, () -> Revision.of("invalid"));
     }
 
-    @Test(expected = DateTimeParseException.class)
+    @Test
     public void testOfInvalidDate1() {
-        Revision.of("2017-13-01");
+        assertThrows(DateTimeParseException.class, () -> Revision.of("2017-13-01"));
     }
 
-    @Test(expected = DateTimeParseException.class)
+    @Test
     public void testOfInvalidDate2() {
-        Revision.of("2017-12-00");
+        assertThrows(DateTimeParseException.class, () -> Revision.of("2017-12-00"));
     }
 
-    @Test(expected = DateTimeParseException.class)
+    @Test
     public void testOfInvalidDate3() {
-        Revision.of("2017-12-32");
+        assertThrows(DateTimeParseException.class, () -> Revision.of("2017-12-32"));
     }
 
     @Test