Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove redundant lambdas from test #20839

Merged
merged 1 commit into from
Feb 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import io.trino.sql.planner.OptimizerConfig;
import org.junit.jupiter.api.Test;

import static org.assertj.core.api.Assertions.assertThatNoException;
import static org.assertj.core.api.Assertions.assertThatThrownBy;

public class TestFilterHideInacessibleColumnsSession
Expand All @@ -46,23 +45,23 @@ public void testEnableWhenAlreadyEnabledByDefault()
FeaturesConfig featuresConfig = new FeaturesConfig();
featuresConfig.setHideInaccessibleColumns(true);
SessionPropertyManager sessionPropertyManager = createSessionPropertyManager(featuresConfig);
assertThatNoException().isThrownBy(() -> sessionPropertyManager.validateSystemSessionProperty(SystemSessionProperties.HIDE_INACCESSIBLE_COLUMNS, "true"));
sessionPropertyManager.validateSystemSessionProperty(SystemSessionProperties.HIDE_INACCESSIBLE_COLUMNS, "true");
}

@Test
public void testDisableWhenAlreadyDisabledByDefault()
{
FeaturesConfig featuresConfig = new FeaturesConfig();
SessionPropertyManager sessionPropertyManager = createSessionPropertyManager(featuresConfig);
assertThatNoException().isThrownBy(() -> sessionPropertyManager.validateSystemSessionProperty(SystemSessionProperties.HIDE_INACCESSIBLE_COLUMNS, "false"));
sessionPropertyManager.validateSystemSessionProperty(SystemSessionProperties.HIDE_INACCESSIBLE_COLUMNS, "false");
}

@Test
public void testEnableWhenDisabledByDefault()
{
FeaturesConfig featuresConfig = new FeaturesConfig();
SessionPropertyManager sessionPropertyManager = createSessionPropertyManager(featuresConfig);
assertThatNoException().isThrownBy(() -> sessionPropertyManager.validateSystemSessionProperty(SystemSessionProperties.HIDE_INACCESSIBLE_COLUMNS, "true"));
sessionPropertyManager.validateSystemSessionProperty(SystemSessionProperties.HIDE_INACCESSIBLE_COLUMNS, "true");
}

private SessionPropertyManager createSessionPropertyManager(FeaturesConfig featuresConfig)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import java.io.OutputStream;

import static java.nio.charset.StandardCharsets.UTF_8;
import static org.assertj.core.api.Assertions.assertThatNoException;

@TestInstance(TestInstance.Lifecycle.PER_CLASS)
public class TestGcsFileSystemGcs
Expand All @@ -37,17 +36,17 @@ void setup()

@Test
void testCreateFileRetry()
throws Exception
{
// Note: this test is meant to expose flakiness
// Without retries it may fail non-deterministically.
// Retries are enabled in the default GcsFileSystemConfig.
// In practice this may happen between 7 and 20 retries.
assertThatNoException().isThrownBy(() -> {
for (int i = 1; i <= 30; i++) {
TrinoOutputFile outputFile = getFileSystem().newOutputFile(getRootLocation().appendPath("testFile"));
try (OutputStream out = outputFile.createOrOverwrite()) {
out.write("test".getBytes(UTF_8));
}
}});
for (int i = 1; i <= 30; i++) {
TrinoOutputFile outputFile = getFileSystem().newOutputFile(getRootLocation().appendPath("testFile"));
try (OutputStream out = outputFile.createOrOverwrite()) {
out.write("test".getBytes(UTF_8));
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

import java.net.InetAddress;
import java.net.Socket;
import java.net.UnknownHostException;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
Expand All @@ -27,20 +26,18 @@

import static java.lang.String.format;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatNoException;

public class TestManuallyJdbcOauth2
{
private static void verifyEtcHostsEntries()
throws UnknownHostException
throws Exception
{
assertThat(InetAddress.getByName("presto-master").isLoopbackAddress()).isTrue();
assertThat(InetAddress.getByName("hydra").isLoopbackAddress()).isTrue();
assertThat(InetAddress.getByName("hydra-consent").isLoopbackAddress()).isTrue();

assertThatNoException()
.describedAs("Trino server is not available under 7778 port")
.isThrownBy(() -> new Socket("presto-master", 7778).close());
// Trino server should be available under 7778 port
new Socket("presto-master", 7778).close();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,14 @@
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;

import static org.assertj.core.api.Assertions.assertThatNoException;
import static org.assertj.core.api.Assertions.assertThatThrownBy;

public class TestReportAfterMethodNotAlwaysRun
{
@Test(dataProvider = "correctCases")
public void testCorrectCases(Class<?> testClass)
{
assertThatNoException().isThrownBy(() -> ReportAfterMethodNotAlwaysRun.checkHasAfterMethodsNotAlwaysRun(testClass));
ReportAfterMethodNotAlwaysRun.checkHasAfterMethodsNotAlwaysRun(testClass);
}

@DataProvider
Expand Down
Loading