Github user pnowojski commented on the issue:

    https://github.com/apache/flink/pull/4321
  
    -- IMO begin
    Mockito tests tends to repeat the implementation. Instead of testing for 
the effect, they tend to do the same thing as the actual code but in backwards. 
In other words, they have that much sense as writing the same feature/code 
twice and then comparing whether outcome is the same. It is valuable at first, 
because you make sure that you didn't make any mistakes. But after that, they 
make your live miserable, because so often changes in the actual code brakes 
them and you have to implement the same thing twice.
    
    Exactly like in this case. I added call `consumer.assignment()` call in the 
production code and then had to spend quite a bit of time understanding why 
some strange test deadlocked. To fix it, I had to implement the same change as 
in the production code in the mock.
    -- IMO ends
    
    If you have a different opinion we can leave it as it is :) It's not worth 
of arguing that much.
    
    There is a comment in the code, but sorry that I didn't state it more 
clearly in this PR itself:
    ```
    // Without assigned partitions KafkaConsumer.poll will throw an exception
    ```
    After version bump (and in Kafka 0.11), `KafkaConsumer.poll()` throws an 
`IllegalStateException` if it doesn't have assigned partitions. Thus we need 
skip this call in that case.



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to