import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
-import java.io.FileNotFoundException;
-import java.net.URISyntaxException;
-import java.text.ParseException;
-import java.util.Date;
import java.util.Set;
import org.junit.Test;
-import org.opendaylight.yangtools.yang.common.SimpleDateFormatUtil;
+import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.model.api.IdentitySchemaNode;
import org.opendaylight.yangtools.yang.model.api.Module;
import org.opendaylight.yangtools.yang.model.api.SchemaContext;
public class IdentityStatementTest {
@Test
- public void testMultipleBaseIdentities() throws ReactorException, FileNotFoundException, URISyntaxException,
- ParseException {
+ public void testMultipleBaseIdentities() throws Exception {
final SchemaContext schemaContext = StmtTestUtils.parseYangSource("/rfc7950/identity-stmt/foo.yang");
assertNotNull(schemaContext);
- final Date revision = SimpleDateFormatUtil.getRevisionFormat().parse("2016-12-21");
-
- final Module foo = schemaContext.findModuleByName("foo", revision);
- assertNotNull(foo);
-
+ final Module foo = schemaContext.findModule("foo", QName.parseRevision("2016-12-21")).get();
final Set<IdentitySchemaNode> identities = foo.getIdentities();
for (final IdentitySchemaNode identity : identities) {
if ("derived-id".equals(identity.getQName().getLocalName())) {
}
@Test
- public void testInvalidYang10() throws FileNotFoundException, URISyntaxException {
+ public void testInvalidYang10() throws Exception {
try {
StmtTestUtils.parseYangSource("/rfc7950/identity-stmt/foo10.yang");
fail("Test should fail due to invalid Yang 1.0");