XComp commented on code in PR #19928:
URL: https://github.com/apache/flink/pull/19928#discussion_r962847108
##########
flink-connectors/flink-connector-gcp-pubsub/src/test/java/org/apache/flink/streaming/connectors/gcp/pubsub/PubSubSourceTest.java:
##########
@@ -66,13 +65,17 @@ public class PubSubSourceTest {
private PubSubSource<String> pubSubSource;
- @Before
- public void setup() throws Exception {
-
when(pubSubSubscriberFactory.getSubscriber(eq(credentials))).thenReturn(pubsubSubscriber);
-
when(streamingRuntimeContext.isCheckpointingEnabled()).thenReturn(true);
- when(streamingRuntimeContext.getMetricGroup()).thenReturn(metricGroup);
- when(metricGroup.addGroup(any(String.class))).thenReturn(metricGroup);
-
when(acknowledgeOnCheckpointFactory.create(any())).thenReturn(acknowledgeOnCheckpoint);
+ @BeforeEach
+ void setup() throws Exception {
+ lenient()
+ .when(pubSubSubscriberFactory.getSubscriber(eq(credentials)))
+ .thenReturn(pubsubSubscriber);
+
lenient().when(streamingRuntimeContext.isCheckpointingEnabled()).thenReturn(true);
+
lenient().when(streamingRuntimeContext.getMetricGroup()).thenReturn(metricGroup);
+
lenient().when(metricGroup.addGroup(any(String.class))).thenReturn(metricGroup);
+ lenient()
+ .when(acknowledgeOnCheckpointFactory.create(any()))
+ .thenReturn(acknowledgeOnCheckpoint);
Review Comment:
I know that there's a bit of time passed since you touched this PR. But can
you elaborate a bit on why we're switching to `lenient` here rather than
sticking to the old approach. My understanding is that `lenient()` relaxes the
test condition a bit?
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]