I have written a custom SQS consumer wherein :
- One coroutine that periodically retrieves the messages
- Multiple workers that process the receiving messages in parallel without blocking.
- A channel to communicate between the MsgReceiver coroutine and the Workers.
However, when writing unit tests I am unable to achieve 100% test coverage kover or with sonar. The kover/sonar plugin complains about partially covered while loop [highlighted in yellow] and I cannot understand which scenario have I missed
Unit test cases:
- When Single message
- When no message
- When 10+ message
- when "no more" message after polling once
- When an error
Actual code :
I looked inside of itr.hasnext() method and there are several branches but unable to understand why code coverage is considering internal methods of the library for code coverage ?
Thanks in advance

Found the issue:
Basically, the hasNext() method from
AbstractChannelclass never returned false.So, mocked the channel, wrote a custom iterator and made
hasNext()return falseAnd it worked like a charm