|
18 | 18 |
|
19 | 19 | import static com.google.common.base.Predicates.alwaysTrue; |
20 | 20 | import static com.google.edwmigration.dumper.application.dumper.connector.snowflake.SnowflakeLogsConnector.earliestTimestamp; |
| 21 | +import static com.google.edwmigration.dumper.application.dumper.connector.snowflake.SnowflakeLogsConnector.formatPrefix; |
21 | 22 | import static com.google.edwmigration.dumper.application.dumper.connector.snowflake.SnowflakeLogsConnector.overrideableQuery; |
22 | 23 | import static org.junit.Assert.assertEquals; |
23 | 24 | import static org.junit.Assert.assertFalse; |
| 25 | +import static org.junit.Assert.assertThrows; |
24 | 26 | import static org.junit.Assert.assertTrue; |
25 | 27 |
|
26 | 28 | import com.google.edwmigration.dumper.application.dumper.ConnectorArguments; |
27 | 29 | import com.google.edwmigration.dumper.application.dumper.MetadataDumperUsageException; |
28 | 30 | import com.google.edwmigration.dumper.test.TestUtils; |
29 | 31 | import java.io.File; |
30 | 32 | import java.io.IOException; |
31 | | -import org.junit.Assert; |
32 | 33 | import org.junit.Test; |
33 | 34 | import org.junit.runner.RunWith; |
34 | 35 | import org.junit.runners.JUnit4; |
@@ -79,6 +80,20 @@ public void earliestTimestamp_provided_resultMatches() throws IOException { |
79 | 80 | assertTrue(result, result.endsWith("\n")); |
80 | 81 | } |
81 | 82 |
|
| 83 | + enum TestEnum { |
| 84 | + FirstValue, |
| 85 | + SecondValue; |
| 86 | + }; |
| 87 | + |
| 88 | + @Test |
| 89 | + public void formatPrefix_success() { |
| 90 | + |
| 91 | + String result = formatPrefix(TestEnum.class, "TASK_HISTORY"); |
| 92 | + |
| 93 | + assertEquals( |
| 94 | + "SELECT FIRST_VALUE, SECOND_VALUE FROM SNOWFLAKE.ACCOUNT_USAGE.TASK_HISTORY", result); |
| 95 | + } |
| 96 | + |
82 | 97 | @Test |
83 | 98 | public void overrideableQuery_overrideAbsent_defaultUsed() throws IOException { |
84 | 99 | String defaultSql = "SELECT event_name, query_id FROM WAREHOUSE_EVENTS_HISTORY"; |
@@ -119,6 +134,6 @@ public void validate_unsupportedOption_throwsException() throws IOException { |
119 | 134 | "--" + ConnectorArguments.OPT_QUERY_LOG_EARLIEST_TIMESTAMP, |
120 | 135 | "2024"); |
121 | 136 |
|
122 | | - Assert.assertThrows(MetadataDumperUsageException.class, () -> connector.validate(arguments)); |
| 137 | + assertThrows(MetadataDumperUsageException.class, () -> connector.validate(arguments)); |
123 | 138 | } |
124 | 139 | } |
0 commit comments