X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=yang%2Fyang-data-impl%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fyangtools%2Fyang%2Fdata%2Fimpl%2Fcodecs%2FStringPatternCheckingCodecTest.java;h=ce836b9e6f41f67f1f3799ef0d19eb6abf342ab7;hb=refs%2Fchanges%2F62%2F68462%2F2;hp=e30ec68800c640a981c7ac8286cb69670de80f66;hpb=66f4ae72e1e7e6f2d91247eff8cba0eb80fdb291;p=yangtools.git diff --git a/yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/codecs/StringPatternCheckingCodecTest.java b/yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/codecs/StringPatternCheckingCodecTest.java index e30ec68800..ce836b9e6f 100644 --- a/yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/codecs/StringPatternCheckingCodecTest.java +++ b/yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/codecs/StringPatternCheckingCodecTest.java @@ -39,24 +39,24 @@ public class StringPatternCheckingCodecTest { @Test public void testStringPatternCheckingCodec() throws ReactorException, ParseException, URISyntaxException, FileNotFoundException { - SchemaContext schemaContext = YangParserTestUtils.parseYangSource("/string-pattern-checking-codec-test.yang"); + final SchemaContext schemaContext = YangParserTestUtils.parseYangSource("/string-pattern-checking-codec-test.yang"); assertNotNull(schemaContext); - QNameModule testModuleQName = QNameModule.create(new URI("string-pattern-checking-codec-test"), + final QNameModule testModuleQName = QNameModule.create(new URI("string-pattern-checking-codec-test"), SimpleDateFormatUtil.getRevisionFormat().parse("1970-01-01")); - Module testModule = schemaContext.findModuleByName("string-pattern-checking-codec-test", null); + final Module testModule = schemaContext.findModuleByName("string-pattern-checking-codec-test", null); assertNotNull(testModule); - ContainerSchemaNode testContainer = (ContainerSchemaNode) testModule.getDataChildByName( + final ContainerSchemaNode testContainer = (ContainerSchemaNode) testModule.getDataChildByName( QName.create(testModuleQName, "test-container")); assertNotNull(testContainer); - LeafSchemaNode testLeaf = (LeafSchemaNode) testContainer.getDataChildByName( + final LeafSchemaNode testLeaf = (LeafSchemaNode) testContainer.getDataChildByName( QName.create(testModuleQName, "string-leaf-with-valid-pattern")); assertNotNull(testLeaf); - StringCodec codec = getCodec(testLeaf.getType(), StringCodec.class); + final StringCodec codec = getCodec(testLeaf.getType(), StringCodec.class); assertNotNull(codec); assertEquals("ABCD", codec.serialize("ABCD")); assertEquals("ABCD", codec.deserialize("ABCD")); @@ -64,9 +64,9 @@ public class StringPatternCheckingCodecTest { try { codec.deserialize("abcd"); fail("Exception should have been thrown."); - } catch (IllegalArgumentException ex) { - LOG.debug("IllegalArgumentException was thrown as expected: {}", ex); - assertTrue(ex.getMessage().contains("is not valid regular expression. [abcd]")); + } catch (final IllegalArgumentException ex) { + LOG.debug("IllegalArgumentException was thrown as expected", ex); + assertEquals("Supplied value does not match the regular expression ^(?:[A-Z]+)$. [abcd]", ex.getMessage()); } } }