You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@rocketmq.apache.org by GitBox <gi...@apache.org> on 2020/06/04 09:23:11 UTC

[GitHub] [rocketmq] vongosling commented on a change in pull request #2059: [ISSUE #2044] Fix DefaultLitePullConsumerImpl NPE

vongosling commented on a change in pull request #2059:
URL: https://github.com/apache/rocketmq/pull/2059#discussion_r435114250



##########
File path: client/src/test/java/org/apache/rocketmq/client/consumer/DefaultLitePullConsumerTest.java
##########
@@ -304,6 +304,29 @@ public void testPauseAndResume_Success() throws Exception {
         }
     }
 
+    @Test
+    public void testPullTaskImpl_ProcessQueueDropped() throws Exception {
+        DefaultLitePullConsumer litePullConsumer = createNotStartLitePullConsumer();
+        try {
+            MessageQueue messageQueue = createMessageQueue();
+            litePullConsumer.assign(Collections.singletonList(messageQueue));
+            Field field = DefaultLitePullConsumer.class.getDeclaredField("defaultLitePullConsumerImpl");
+            field.setAccessible(true);
+            // set ProcessQueue dropped = true
+            DefaultLitePullConsumerImpl localLitePullConsumerImpl = (DefaultLitePullConsumerImpl) field.get(litePullConsumer);
+            field = DefaultLitePullConsumerImpl.class.getDeclaredField("assignedMessageQueue");
+            field.setAccessible(true);

Review comment:
       powermock provide mock private method. you could use it to test null case and dropped case separately




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

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