Migrate users of deprecated QNameModule methods
[yangtools.git] / model / yang-model-util / src / test / java / org / opendaylight / yangtools / yang / model / util / SimpleSchemaContextTest.java
index fbf37196cf5aed1187ece1f06624832d6ebdd9c7..6fca3c698e1a9f2b5eb13b6958cd5439f008faad 100644 (file)
@@ -12,11 +12,9 @@ import static org.mockito.Mockito.doReturn;
 import static org.mockito.Mockito.mock;
 
 import java.util.List;
-import java.util.Optional;
 import java.util.Set;
 import org.junit.jupiter.api.Test;
 import org.opendaylight.yangtools.yang.common.QNameModule;
-import org.opendaylight.yangtools.yang.common.Revision;
 import org.opendaylight.yangtools.yang.common.XMLNamespace;
 import org.opendaylight.yangtools.yang.model.api.Module;
 import org.opendaylight.yangtools.yang.model.spi.SimpleSchemaContext;
@@ -24,9 +22,9 @@ import org.opendaylight.yangtools.yang.model.spi.SimpleSchemaContext;
 class SimpleSchemaContextTest {
     @Test
     void testGetModulesOrdering() {
-        final var foo0 = mockModule("foo", Optional.empty());
-        final var foo1 = mockModule("foo", Revision.ofNullable("2018-01-01"));
-        final var foo2 = mockModule("foo", Revision.ofNullable("2018-01-16"));
+        final var foo0 = mockModule("foo", null);
+        final var foo1 = mockModule("foo", "2018-01-01");
+        final var foo2 = mockModule("foo", "2018-01-16");
 
         final var expected = List.of(foo2, foo1, foo0);
         assertGetModules(expected, foo0, foo1, foo2);
@@ -68,12 +66,12 @@ class SimpleSchemaContextTest {
         assertArrayEquals(expected.toArray(), actual.toArray());
     }
 
-    private static Module mockModule(final String name, final Optional<Revision> revision) {
-        final var mod = QNameModule.create(XMLNamespace.of(name), revision);
+    private static Module mockModule(final String name, final String revision) {
+        final var mod = QNameModule.ofRevision(name, revision);
         final var ret = mock(Module.class);
         doReturn(name).when(ret).getName();
-        doReturn(mod.getNamespace()).when(ret).getNamespace();
-        doReturn(mod.getRevision()).when(ret).getRevision();
+        doReturn(mod.namespace()).when(ret).getNamespace();
+        doReturn(mod.findRevision()).when(ret).getRevision();
         doReturn(mod).when(ret).getQNameModule();
         doReturn(mod.toString()).when(ret).toString();
         doReturn(Set.of()).when(ret).getImports();