Skip to content

Commit

Permalink
Replace the deprecated method getCause with cause method
Browse files Browse the repository at this point in the history
  • Loading branch information
krvikash authored and ebyhr committed Mar 17, 2023
1 parent 53b3d9f commit f29512b
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ protected void verifyConcurrentUpdateFailurePermissible(Exception e)
{
assertThat(e)
.hasMessage("Failed to write Delta Lake transaction log entry")
.getCause()
.cause()
.hasMessageMatching(
"Transaction log locked.*" +
"|.*/_delta_log/\\d+.json already exists" +
Expand All @@ -154,7 +154,7 @@ protected void verifyConcurrentInsertFailurePermissible(Exception e)
{
assertThat(e)
.hasMessage("Failed to write Delta Lake transaction log entry")
.getCause()
.cause()
.hasMessageMatching(
"Transaction log locked.*" +
"|.*/_delta_log/\\d+.json already exists" +
Expand All @@ -168,7 +168,7 @@ protected void verifyConcurrentAddColumnFailurePermissible(Exception e)
{
assertThat(e)
.hasMessageMatching("Unable to add '.*' column for: .*")
.getCause()
.cause()
.hasMessageMatching(
"Transaction log locked.*" +
"|.*/_delta_log/\\d+.json already exists" +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ public void testUpdateRowConcurrently()
// TODO (https://github.com/trinodb/trino/issues/10518) test this with a TestHiveConnectorTest version that creates ACID tables by default, or in some other way
assertThatThrownBy(super::testUpdateRowConcurrently)
.hasMessage("Unexpected concurrent update failure")
.getCause()
.cause()
.hasMessage(MODIFYING_NON_TRANSACTIONAL_TABLE_MESSAGE);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ public void testUnsupportedBigint()
private void assertIgniteQueryFailsWithColumnValueOutRange(@Language("SQL") String sql)
{
assertThatThrownBy(() -> igniteServer.execute(sql))
.getCause()
.cause()
.hasMessageContaining("Value conversion failed");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1108,7 +1108,7 @@ private DataSetup mysqlCreateAndInsert(String tableNamePrefix)
private void assertMySqlQueryFails(@Language("SQL") String sql, String expectedMessage)
{
assertThatThrownBy(() -> mySqlServer.execute(sql))
.getCause()
.cause()
.hasMessageContaining(expectedMessage);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -777,7 +777,7 @@ private Session sessionWithDecimalMappingStrict(UnsupportedTypeHandling unsuppor
private void assertPhoenixQueryFails(@Language("SQL") String sql, String expectedMessage)
{
assertThatThrownBy(() -> new PhoenixSqlExecutor(phoenixServer.getJdbcUrl()).execute(sql))
.getCause()
.cause()
.hasMessageContaining(expectedMessage);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1917,7 +1917,7 @@ private static void checkIsDoubled(ZoneId zone, LocalDateTime dateTime)
private void assertPostgreSqlQueryFails(@Language("SQL") String sql, String expectedMessage)
{
assertThatThrownBy(() -> postgreSqlServer.execute(sql))
.getCause()
.cause()
.hasMessageContaining(expectedMessage);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -926,7 +926,7 @@ protected void verifyConcurrentAddColumnFailurePermissible(Exception e)
{
assertThat(e)
.hasMessageContaining("Failed to perform metadata operation")
.getCause()
.cause()
.hasMessageMatching(
"(?s).*SQLIntegrityConstraintViolationException.*" +
"|.*Unique index or primary key violation.*" +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ public void checkUnicodeCharInRedshift()
try (TestTable table = testTable("check_multibyte_char", "(c char(32))")) {
assertThatThrownBy(() -> getRedshiftExecutor()
.execute(format("INSERT INTO %s VALUES ('\u968a')", table.getName())))
.getCause()
.cause()
.isInstanceOf(SQLException.class)
.hasMessageContaining("CHAR string contains invalid ASCII character");
}
Expand Down Expand Up @@ -842,7 +842,7 @@ private static void assertRedshiftCreateFails(String tableNamePrefix, String tab
try {
assertThatThrownBy(() -> getRedshiftExecutor()
.execute(format("CREATE TABLE %s %s", tableName, tableBody)))
.getCause()
.cause()
.as("Redshift create fails for %s %s", tableName, tableBody)
.isInstanceOf(SQLException.class)
.hasMessage(message);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -872,7 +872,7 @@ private static void checkIsGap(ZoneId zone, LocalDateTime dateTime)
private void assertSqlServerQueryFails(@Language("SQL") String sql, String expectedMessage)
{
assertThatThrownBy(() -> onRemoteDatabase().execute(sql))
.getCause()
.cause()
.hasMessageContaining(expectedMessage);
}

Expand Down

0 comments on commit f29512b

Please sign in to comment.