Simplify assertions in SHOW TABLES test
@@ -64,8 +64,6 @@ import static com.facebook.presto.spi.type.IntegerType.INTEGER;
import static com.facebook.presto.spi.type.VarcharType.VARCHAR;
import static com.facebook.presto.spi.type.VarcharType.createVarcharType;
import static com.facebook.presto.sql.analyzer.SemanticErrorCode.INVALID_PARAMETER_USAGE;
-import static com.facebook.presto.sql.analyzer.SemanticErrorCode.MISSING_CATALOG;
-import static com.facebook.presto.sql.analyzer.SemanticErrorCode.MISSING_SCHEMA;
import static com.facebook.presto.sql.analyzer.SemanticErrorCode.MUST_BE_AGGREGATE_OR_GROUP_BY;
import static com.facebook.presto.sql.tree.ExplainType.Type.DISTRIBUTED;
import static com.facebook.presto.sql.tree.ExplainType.Type.IO;
@@ -4650,27 +4648,8 @@ public abstract class AbstractTestQueries
result = computeActual("SHOW TABLES FROM " + catalog + "." + schema);
assertTrue(result.getOnlyColumnAsSet().containsAll(expectedTables));
- try {
- computeActual("SHOW TABLES FROM UNKNOWN");
- fail("Showing tables in an unknown schema should fail");
- }
- catch (SemanticException e) {
- assertEquals(e.getCode(), MISSING_SCHEMA);
- }
- catch (RuntimeException e) {
- assertEquals(e.getMessage(), "line 1:1: Schema 'unknown' does not exist");
- }
-
- try {
- computeActual("SHOW TABLES FROM UNKNOWNCATALOG.UNKNOWNSCHEMA");
- fail("Showing tables in an unknown catalog and unknown schema should fail with unknown catalog");
- }
- catch (SemanticException e) {
- assertEquals(e.getCode(), MISSING_CATALOG);
- }
- catch (RuntimeException e) {
- assertEquals(e.getMessage(), "line 1:1: Catalog 'unknowncatalog' does not exist");
- }
+ assertQueryFails("SHOW TABLES FROM UNKNOWN", "line 1:1: Schema 'unknown' does not exist");
+ assertQueryFails("SHOW TABLES FROM UNKNOWNCATALOG.UNKNOWNSCHEMA", "line 1:1: Catalog 'unknowncatalog' does not exist");
}
@Test
