diff --git a/modules/gcloud/src/test/java/org/testcontainers/containers/BigtableEmulatorContainerTest.java b/modules/gcloud/src/test/java/org/testcontainers/containers/BigtableEmulatorContainerTest.java index e68ecce405b..8a100855b3c 100644 --- a/modules/gcloud/src/test/java/org/testcontainers/containers/BigtableEmulatorContainerTest.java +++ b/modules/gcloud/src/test/java/org/testcontainers/containers/BigtableEmulatorContainerTest.java @@ -15,6 +15,7 @@ import com.google.cloud.bigtable.data.v2.models.Row; import com.google.cloud.bigtable.data.v2.models.RowCell; import com.google.cloud.bigtable.data.v2.models.RowMutation; +import com.google.cloud.bigtable.data.v2.models.TableId; import io.grpc.ManagedChannel; import io.grpc.ManagedChannelBuilder; import org.junit.Rule; @@ -23,7 +24,6 @@ import java.io.IOException; import java.util.List; -import java.util.concurrent.ExecutionException; import static org.assertj.core.api.Assertions.assertThat; @@ -43,28 +43,26 @@ public class BigtableEmulatorContainerTest { @Test // testWithEmulatorContainer { - public void testSimple() throws IOException, InterruptedException, ExecutionException { + public void testSimple() throws IOException { ManagedChannel channel = ManagedChannelBuilder.forTarget(emulator.getEmulatorEndpoint()).usePlaintext().build(); TransportChannelProvider channelProvider = FixedTransportChannelProvider.create( GrpcTransportChannel.create(channel) ); NoCredentialsProvider credentialsProvider = NoCredentialsProvider.create(); - - try { - createTable(channelProvider, credentialsProvider, "test-table"); - + createTable(channelProvider, credentialsProvider, "test-table"); + try ( BigtableDataClient client = BigtableDataClient.create( BigtableDataSettings .newBuilderForEmulator(emulator.getHost(), emulator.getEmulatorPort()) .setProjectId(PROJECT_ID) .setInstanceId(INSTANCE_ID) .build() - ); - - client.mutateRow(RowMutation.create("test-table", "1").setCell("name", "firstName", "Ray")); + ) + ) { + client.mutateRow(RowMutation.create(TableId.of("test-table"), "1").setCell("name", "firstName", "Ray")); - Row row = client.readRow("test-table", "1"); + Row row = client.readRow(TableId.of("test-table"), "1"); List cells = row.getCells("name", "firstName"); assertThat(cells).isNotNull().hasSize(1); diff --git a/modules/pulsar/src/test/java/org/testcontainers/containers/AbstractPulsar.java b/modules/pulsar/src/test/java/org/testcontainers/containers/AbstractPulsar.java index 5246fc6b8ad..c704ce15d41 100644 --- a/modules/pulsar/src/test/java/org/testcontainers/containers/AbstractPulsar.java +++ b/modules/pulsar/src/test/java/org/testcontainers/containers/AbstractPulsar.java @@ -24,12 +24,16 @@ public class AbstractPulsar { protected void testPulsarFunctionality(String pulsarBrokerUrl) throws Exception { try ( PulsarClient client = PulsarClient.builder().serviceUrl(pulsarBrokerUrl).build(); - Consumer consumer = client.newConsumer().topic(TEST_TOPIC).subscriptionName("test-subs").subscribe(); + Consumer consumer = client + .newConsumer() + .topic(TEST_TOPIC) + .subscriptionName("test-subs") + .subscribe(); Producer producer = client.newProducer().topic(TEST_TOPIC).create() ) { producer.send("test containers".getBytes()); - CompletableFuture future = consumer.receiveAsync(); - Message message = future.get(5, TimeUnit.SECONDS); + CompletableFuture> future = consumer.receiveAsync(); + Message message = future.get(5, TimeUnit.SECONDS); assertThat(new String(message.getData())).isEqualTo("test containers"); }