sandeep-mst commented on code in PR #25207:
URL: https://github.com/apache/pulsar/pull/25207#discussion_r2769358090


##########
pulsar-client/src/test/java/org/apache/pulsar/client/impl/ProducerImplTest.java:
##########
@@ -67,4 +70,79 @@ public void testPopulateMessageSchema() {
         assertTrue(producer.populateMessageSchema(msg, null));
         verify(msg).setSchemaState(MessageImpl.SchemaState.Ready);
     }
+
+    @Test
+    public void testFailPendingMessagesSyncRetry()
+            throws Exception {
+        ProducerImpl<byte[]> producer =
+                Mockito.mock(ProducerImpl.class, Mockito.CALLS_REAL_METHODS);
+        Mockito.doNothing()
+                .when(producer)
+                .semaphoreRelease(Mockito.anyInt());
+        Mockito.doReturn(false)
+                .when(producer)
+                .isBatchMessagingEnabled();
+
+        // Real pending queue
+        ProducerImpl.OpSendMsgQueue pendingQueue = new 
ProducerImpl.OpSendMsgQueue();
+        Field pendingField = 
ProducerImpl.class.getDeclaredField("pendingMessages");
+        pendingField.setAccessible(true);
+        pendingField.set(producer, pendingQueue);

Review Comment:
   done. Used `FieldUtils` as the `@Getter` approach is not possible for this 
producer mock as the `pendingMessages` field is `final` .



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