dajac commented on code in PR #12783:
URL: https://github.com/apache/kafka/pull/12783#discussion_r1016427264


##########
core/src/test/scala/unit/kafka/server/ReplicaFetcherThreadTest.scala:
##########
@@ -1100,6 +1102,67 @@ class ReplicaFetcherThreadTest {
     assertEquals(Collections.singletonList(tid1p0), 
fetchRequestBuilder2.removed())
   }
 
+  @ParameterizedTest
+  @ValueSource(booleans = Array(true, false))
+  def testLocalFetchCompletionIfHighWatermarkUpdated(highWatermarkUpdated: 
Boolean): Unit = {
+    val props = TestUtils.createBrokerConfig(1, "localhost:1234")
+    val config = KafkaConfig.fromProps(props)
+    val highWatermarkReceivedFromLeader = 100L
+
+    val mockBlockingSend: BlockingSend = mock(classOf[BlockingSend])
+    when(mockBlockingSend.brokerEndPoint()).thenReturn(brokerEndPoint)
+
+    var maybeNewHighWatermark: Option[Long] = None
+    if (highWatermarkUpdated) {
+      maybeNewHighWatermark = Some(highWatermarkReceivedFromLeader)
+    }

Review Comment:
   small nit: In Scala, we tend to write this as follow:
   
   ```
   val maybeNewHighWatermark = if (highWatermarkUpdated) {
     Some(highWatermarkReceivedFromLeader)
   } else {
     None
   }
   ```
   
   It may also fit on one line.



-- 
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: jira-unsubscr...@kafka.apache.org

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

Reply via email to