chia7712 commented on code in PR #16603:
URL: https://github.com/apache/kafka/pull/16603#discussion_r1679991062


##########
core/src/test/scala/unit/kafka/log/ProducerStateManagerTest.scala:
##########
@@ -1175,6 +1175,45 @@ class ProducerStateManagerTest {
     assertNull(stateManager.verificationStateEntry(producerId))
   }
 
+  @Test
+  def testReadWriteSnapshot(): Unit = {
+    val entry = new ProducerStateEntry(1L, 2, 3, RecordBatch.NO_TIMESTAMP,

Review Comment:
   Could you please do a bit refactor for it? for example:
   ```scala
       val expectedEntryMap = new java.util.HashMap[java.lang.Long, 
ProducerStateEntry]
       expectedEntryMap.put(1, new ProducerStateEntry(1L, 2, 3, 
RecordBatch.NO_TIMESTAMP,
         OptionalLong.of(100L), java.util.Optional.of(new BatchMetadata(1, 2L, 
3, RecordBatch.NO_TIMESTAMP))))
       expectedEntryMap.put(11, new ProducerStateEntry(11L, 12, 13, 123456L,
         OptionalLong.empty(), java.util.Optional.empty()))
   
       def assertEntries(actual: util.List[ProducerStateEntry]): Unit = {
         val actualEntryMap = actual.asScala.map(p => (p.producerId(), 
p)).toMap.asJava
         assertEquals(expectedEntryMap.keySet(), actualEntryMap.keySet())
         expectedEntryMap.forEach {
           case (producerId, entry) =>
             assertProducerStateEntry(entry, actualEntryMap.get(producerId))
         }
       }
   ```



-- 
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]

Reply via email to