codelipenghui commented on code in PR #15594:
URL: https://github.com/apache/pulsar/pull/15594#discussion_r1010357093


##########
pulsar-client/src/test/java/org/apache/pulsar/client/impl/MultiTopicsConsumerImplTest.java:
##########
@@ -243,4 +249,74 @@ public void 
testDontCheckForPartitionsUpdatesOnNonPartitionedTopics() throws Exc
         verify(clientMock, times(3)).getPartitionedTopicMetadata(any());
     }
 
+    @Test
+    public void testReconsumeLaterWhenRetryDisabled() {
+        MultiTopicsConsumerImpl<byte[]> consumer = createMultiTopicsConsumer();
+
+        MessageId messageId = new TopicMessageIdImpl("topic-partition-1", 
"topic",
+                new MessageIdImpl(0, 0, 0));
+        ByteBuffer payload = ByteBuffer.wrap(new byte[0]);
+        MessageImpl<?> msg = MessageImpl.create(new MessageMetadata(), 
payload, Schema.BYTES, null);
+        msg.setMessageId(messageId);
+        Throwable cause1 = null;
+        try {
+            consumer.reconsumeLater(msg, null, 1, TimeUnit.MINUTES);
+        } catch (PulsarClientException e) {
+            cause1 = e;
+        }
+        assertNotNull(cause1);
+        assertEquals(cause1.getClass(), 
PulsarClientException.NotSupportedException.class);

Review Comment:
   Can simplify with 
   
   ```java
    try {
        consumer.reconsumeLater(msg, null, 1, TimeUnit.MINUTES);
        fail("Should failed with PulsarClientException.NotSupportedException")
    } catch (PulsarClientException.NotSupportedException e) {
    }
   ```



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