snuyanzin commented on code in PR #27:
URL: 
https://github.com/apache/flink-connector-gcp-pubsub/pull/27#discussion_r1601874397


##########
flink-connector-gcp-pubsub/src/test/java/org/apache/flink/connector/gcp/pubsub/sink/PubSubSinkV2BuilderTest.java:
##########
@@ -0,0 +1,133 @@
+package org.apache.flink.connector.gcp.pubsub.sink;
+
+import org.apache.flink.api.common.serialization.SerializationSchema;
+import org.apache.flink.api.common.serialization.SimpleStringSchema;
+import org.apache.flink.connector.gcp.pubsub.sink.config.GcpPublisherConfig;
+
+import com.google.api.gax.core.NoCredentialsProvider;
+import org.assertj.core.api.Assertions;
+import org.junit.jupiter.api.Test;
+
+import static 
org.apache.flink.connector.gcp.pubsub.common.PubSubConstants.DEFAULT_FAIL_ON_ERROR;
+import static 
org.apache.flink.connector.gcp.pubsub.common.PubSubConstants.DEFAULT_MAXIMUM_INFLIGHT_REQUESTS;
+
+/** Tests for {@link PubSubSinkV2Builder}. */
+public class PubSubSinkV2BuilderTest {
+
+    @Test
+    void builderBuildsSinkWithCorrectProperties() {
+        PubSubSinkV2Builder<String> builder = PubSubSinkV2.<String>builder();
+        GcpPublisherConfig gcpPublisherConfig =
+                GcpPublisherConfig.builder()
+                        .setCredentialsProvider(NoCredentialsProvider.create())
+                        .build();
+
+        SerializationSchema<String> serializationSchema = new 
SimpleStringSchema();
+
+        builder.setProjectId("test-project-id")
+                .setTopicId("test-topic-id")
+                .setGcpPublisherConfig(gcpPublisherConfig)
+                .setSerializationSchema(serializationSchema)
+                .setNumMaxInflightRequests(10)
+                .setFailOnError(true);
+        PubSubSinkV2<String> sink = builder.build();
+
+        Assertions.assertThat(sink).hasFieldOrPropertyWithValue("projectId", 
"test-project-id");
+        Assertions.assertThat(sink).hasFieldOrPropertyWithValue("topicId", 
"test-topic-id");
+        Assertions.assertThat(sink)
+                .hasFieldOrPropertyWithValue("serializationSchema", 
serializationSchema);
+        Assertions.assertThat(sink)
+                .hasFieldOrPropertyWithValue("publisherConfig", 
gcpPublisherConfig);
+        
Assertions.assertThat(sink).hasFieldOrPropertyWithValue("maxInFlightRequests", 
10);
+        Assertions.assertThat(sink).hasFieldOrPropertyWithValue("failOnError", 
true);

Review Comment:
   normally in Flink code we have `static import` for `Assertions`, I think we 
should follow same here



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@flink.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to