vlsi commented on a change in pull request #2371:
URL: https://github.com/apache/calcite/pull/2371#discussion_r593766808



##########
File path: server/src/test/java/org/apache/calcite/test/ServerTest.java
##########
@@ -532,4 +532,28 @@ static Connection connect() throws SQLException {
       }
     }
   }
+
+  @Test public void testDropWithFullyQualifiedNameWhenSchemaDoesntExist() 
throws Exception {
+    try (Connection c = connect();
+         Statement s = c.createStatement()) {
+      checkDropWithFullyQualifiedNameWhenSchemaDoesntExist(s, "schema", 
"Schema");
+      checkDropWithFullyQualifiedNameWhenSchemaDoesntExist(s, "table", 
"Table");
+      checkDropWithFullyQualifiedNameWhenSchemaDoesntExist(s, "materialized 
view", "Table");
+      checkDropWithFullyQualifiedNameWhenSchemaDoesntExist(s, "view", "View");
+      checkDropWithFullyQualifiedNameWhenSchemaDoesntExist(s, "type", "Type");
+      checkDropWithFullyQualifiedNameWhenSchemaDoesntExist(s, "function", 
"Function");
+    }
+  }
+
+  private void checkDropWithFullyQualifiedNameWhenSchemaDoesntExist(
+      Statement statement, String objectType, String objectTypeInErrorMessage) 
throws Exception {
+    try {
+      statement.execute("drop " + objectType + " s.o");
+      fail("expected error");

Review comment:
       I suggest `assertThrows` since:
   1) It better structures the code (it is easier to see which block is 
expected to fail)
   2) It has `reason` parameter. Please add proper reasoning that explains why 
`expected error`.

##########
File path: server/src/test/java/org/apache/calcite/test/ServerTest.java
##########
@@ -532,4 +532,28 @@ static Connection connect() throws SQLException {
       }
     }
   }
+
+  @Test public void testDropWithFullyQualifiedNameWhenSchemaDoesntExist() 
throws Exception {
+    try (Connection c = connect();
+         Statement s = c.createStatement()) {
+      checkDropWithFullyQualifiedNameWhenSchemaDoesntExist(s, "schema", 
"Schema");
+      checkDropWithFullyQualifiedNameWhenSchemaDoesntExist(s, "table", 
"Table");
+      checkDropWithFullyQualifiedNameWhenSchemaDoesntExist(s, "materialized 
view", "Table");
+      checkDropWithFullyQualifiedNameWhenSchemaDoesntExist(s, "view", "View");
+      checkDropWithFullyQualifiedNameWhenSchemaDoesntExist(s, "type", "Type");
+      checkDropWithFullyQualifiedNameWhenSchemaDoesntExist(s, "function", 
"Function");
+    }
+  }
+
+  private void checkDropWithFullyQualifiedNameWhenSchemaDoesntExist(
+      Statement statement, String objectType, String objectTypeInErrorMessage) 
throws Exception {
+    try {
+      statement.execute("drop " + objectType + " s.o");
+      fail("expected error");

Review comment:
       I suggest `Assertions.assertThrows` since:
   1) It better structures the code (it is easier to see which block is 
expected to fail)
   2) It has `reason` parameter. Please add proper reasoning that explains why 
`expected error`.




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to