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;
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);
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]"));
}
}
}