nikam14 commented on issue #21535:
URL: https://github.com/apache/pulsar/issues/21535#issuecomment-2003184510

   In the Test revalidateLeaderWithinSameSession() it is calling 
assertEqualsAndRetry() method in which it is using Lambda Expression. There it 
is calling the actual.get() method two times. 
   First at line no. - 130
   ` if (actual.get().equals(expectedAndRetry)) {`
   Second at line no. - 133
   ` assertEquals(actual.get(), expected);`
   Here we are calling the Object twice. Calling actual.get() method twice 
which may return different object at both times. Instead we can call it once 
store it and check both the conditions . In this way at both conditions we are 
checking the same Object. 
   
   We can change this to 
   
![1](https://github.com/apache/pulsar/assets/55378196/da7daf66-3583-435e-9d85-d45dc0d46285)
   this
   
![2](https://github.com/apache/pulsar/assets/55378196/8db2cc4c-298f-4d6f-972a-bdbe1090995c)


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