BUG-4688: eliminate SimpleDateFormatUtil.DEFAULT_DATE_REV
[yangtools.git] / yang / yang-data-impl / src / test / java / org / opendaylight / yangtools / yang / data / impl / codecs / StringPatternCheckingCodecTest.java
index 322de0e655a055e339900cfffb22ac9a288ce7d2..b0aa31c35717fe69bf08f8431e586a1fd0dca858 100644 (file)
@@ -17,11 +17,9 @@ import static org.opendaylight.yangtools.yang.data.impl.codecs.TypeDefinitionAwa
 import java.io.FileNotFoundException;
 import java.net.URI;
 import java.net.URISyntaxException;
-import java.text.ParseException;
 import org.junit.Test;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.common.QNameModule;
-import org.opendaylight.yangtools.yang.common.SimpleDateFormatUtil;
 import org.opendaylight.yangtools.yang.data.api.codec.StringCodec;
 import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
 import org.opendaylight.yangtools.yang.model.api.LeafSchemaNode;
@@ -37,17 +35,15 @@ public class StringPatternCheckingCodecTest {
     private static final Logger LOG = LoggerFactory.getLogger(StringPatternCheckingCodecTest.class);
 
     @Test
-    public void testStringPatternCheckingCodec() throws ReactorException, ParseException, URISyntaxException,
+    public void testStringPatternCheckingCodec() throws ReactorException, URISyntaxException,
             FileNotFoundException {
-        final SchemaContext schemaContext = YangParserTestUtils.parseYangResource("/string-pattern-checking-codec-test.yang");
+        final SchemaContext schemaContext = YangParserTestUtils.parseYangResource(
+            "/string-pattern-checking-codec-test.yang");
         assertNotNull(schemaContext);
 
-        final QNameModule testModuleQName = QNameModule.create(new URI("string-pattern-checking-codec-test"),
-                SimpleDateFormatUtil.getRevisionFormat().parse("1970-01-01"));
-
-        final Module testModule = schemaContext.findModuleByName("string-pattern-checking-codec-test", null);
-        assertNotNull(testModule);
+        final QNameModule testModuleQName = QNameModule.create(new URI("string-pattern-checking-codec-test"), null);
 
+        final Module testModule = schemaContext.findModules("string-pattern-checking-codec-test").iterator().next();
         final ContainerSchemaNode testContainer = (ContainerSchemaNode) testModule.getDataChildByName(
                 QName.create(testModuleQName, "test-container"));
         assertNotNull(testContainer);
@@ -66,7 +62,8 @@ public class StringPatternCheckingCodecTest {
             fail("Exception should have been thrown.");
         } catch (final IllegalArgumentException ex) {
             LOG.debug("IllegalArgumentException was thrown as expected: {}", ex);
-            assertTrue(ex.getMessage().contains("Supplied value does not match the regular expression ^[A-Z]+$. [abcd]"));
+            assertTrue(ex.getMessage().contains(
+                "Supplied value does not match the regular expression ^[A-Z]+$. [abcd]"));
         }
     }
 }