Encapsulate regexes in a non-capturing group
[yangtools.git] / yang / yang-data-impl / src / test / java / org / opendaylight / yangtools / yang / data / impl / codecs / StringPatternCheckingCodecTest.java
index 39ea19159402d50d40b3130c0f5379bf7ae4417a..4cf56becb503188523168ebf5c74595c5caede50 100644 (file)
@@ -10,13 +10,10 @@ package org.opendaylight.yangtools.yang.data.impl.codecs;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 import static org.opendaylight.yangtools.yang.data.impl.codecs.TypeDefinitionAwareCodecTestHelper.getCodec;
 
-import java.io.FileNotFoundException;
 import java.net.URI;
-import java.net.URISyntaxException;
 import org.junit.Test;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.common.QNameModule;
@@ -25,7 +22,6 @@ import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
 import org.opendaylight.yangtools.yang.model.api.LeafSchemaNode;
 import org.opendaylight.yangtools.yang.model.api.Module;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
-import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
 import org.opendaylight.yangtools.yang.test.util.YangParserTestUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -35,8 +31,7 @@ public class StringPatternCheckingCodecTest {
     private static final Logger LOG = LoggerFactory.getLogger(StringPatternCheckingCodecTest.class);
 
     @Test
-    public void testStringPatternCheckingCodec() throws ReactorException, URISyntaxException,
-            FileNotFoundException {
+    public void testStringPatternCheckingCodec() {
         final SchemaContext schemaContext = YangParserTestUtils.parseYangResource(
             "/string-pattern-checking-codec-test.yang");
         assertNotNull(schemaContext);
@@ -61,9 +56,8 @@ public class StringPatternCheckingCodecTest {
             codec.deserialize("abcd");
             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]"));
+            LOG.debug("IllegalArgumentException was thrown as expected", ex);
+            assertEquals("Supplied value does not match the regular expression ^(?:[A-Z]+)$.", ex.getMessage());
         }
     }
 }