snuyanzin commented on code in PR #26385:
URL: https://github.com/apache/flink/pull/26385#discussion_r2031798763


##########
flink-table/flink-table-api-java/src/test/java/org/apache/flink/table/api/TableEnvironmentTest.java:
##########
@@ -212,4 +336,39 @@ private static void 
assertTemporaryCreateTableFromDescriptor(
         
assertThat(catalogTable.getOptions().get("connector")).isEqualTo("fake");
         assertThat(catalogTable.getOptions().get("a")).isEqualTo("Test");
     }
+
+    private static void assertCreateModelFromDescriptor(
+            TableEnvironmentMock tEnv, boolean ignoreIfExists) throws 
ModelNotExistException {
+        final String catalog = tEnv.getCurrentCatalog();
+        final String database = tEnv.getCurrentDatabase();
+
+        if (ignoreIfExists) {
+            tEnv.createModel("M", TEST_MODEL_DESCRIPTOR, true);
+        } else {
+            tEnv.createModel("M", TEST_MODEL_DESCRIPTOR);
+        }
+
+        final ObjectPath objectPath = new ObjectPath(database, "M");
+        CatalogModel catalogModel =
+                
tEnv.getCatalog(catalog).orElseThrow(AssertionError::new).getModel(objectPath);
+        assertThat(catalogModel).isInstanceOf(CatalogModel.class);
+        assertThat(catalogModel.getInputSchema()).isEqualTo(TEST_SCHEMA);
+        assertThat(catalogModel.getOptions().get("a")).isEqualTo("Test");
+    }
+
+    private static void assertTemporaryCreateModelFromDescriptor(
+            TableEnvironmentMock tEnv, boolean ignoreIfExists) {
+        final String catalog = tEnv.getCurrentCatalog();
+        final String database = tEnv.getCurrentDatabase();
+
+        tEnv.createTemporaryModel("M", TEST_MODEL_DESCRIPTOR, ignoreIfExists);
+        final Optional<ContextResolvedModel> lookupResult =
+                tEnv.getCatalogManager().getModel(ObjectIdentifier.of(catalog, 
database, "M"));
+        assertThat(lookupResult.isPresent()).isTrue();
+        CatalogModel catalogModel = lookupResult.get().getResolvedModel();
+        assertThat(catalogModel != null).isTrue();

Review Comment:
   why not
   ```suggestion
           assertThat(catalogModel\0.isNotNull();
   ```
   ?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@flink.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to