Github user vrozov commented on a diff in the pull request:
https://github.com/apache/drill/pull/1225#discussion_r185375540
--- Diff:
exec/java-exec/src/test/java/org/apache/drill/exec/sql/TestCTTAS.java ---
@@ -498,47 +489,50 @@ public void
testDropTemporaryTableAsViewWithoutException() throws Exception {
.go();
}
- @Test(expected = UserRemoteException.class)
+ @Test
public void testDropTemporaryTableAsViewWithException() throws Exception
{
String temporaryTableName =
"temporary_table_to_drop_like_view_with_exception";
test("create TEMPORARY table %s as select 'A' as c1 from (values(1))",
temporaryTableName);
- try {
- test("drop view %s.%s", DFS_TMP_SCHEMA, temporaryTableName);
- } catch (UserRemoteException e) {
- assertThat(e.getMessage(), containsString(String.format(
- "VALIDATION ERROR: Unknown view [%s] in schema [%s]",
temporaryTableName, DFS_TMP_SCHEMA)));
- throw e;
+ thrown.expect(UserRemoteException.class);
+ thrown.expectMessage(containsString(String.format(
+ "VALIDATION ERROR: Unknown view [%s] in schema [%s]",
temporaryTableName, DFS_TMP_SCHEMA)));
+
+ test("drop view %s.%s", DFS_TMP_SCHEMA, temporaryTableName);
+ }
+
+ private static String getSessionId() throws Exception {
--- End diff --
Consider mocking getSessionId() in the `UserSession`. This method needs to
be tested by itself.
---