susheel-gupta commented on code in PR #5295:
URL: https://github.com/apache/hadoop/pull/5295#discussion_r1080982699
##########
hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapred/TestTaskAttemptListenerImpl.java:
##########
@@ -257,12 +260,6 @@ public void testGetMapCompletionEvents() throws
IOException {
createTce(3, false, TaskAttemptCompletionEventStatus.FAILED) };
TaskAttemptCompletionEvent[] mapEvents = { taskEvents[0], taskEvents[2] };
Job mockJob = mock(Job.class);
- when(mockJob.getTaskAttemptCompletionEvents(0, 100))
- .thenReturn(taskEvents);
- when(mockJob.getTaskAttemptCompletionEvents(0, 2))
- .thenReturn(Arrays.copyOfRange(taskEvents, 0, 2));
- when(mockJob.getTaskAttemptCompletionEvents(2, 100))
- .thenReturn(Arrays.copyOfRange(taskEvents, 2, 4));
Review Comment:
To bypass strict stubs we use lenient strictness, as in new upgrade mockito
is introducing new features that nudge the framework towards “strictness”.
I don't see any advantage here in this scenario, other than keeping the code
as it is.
Disadvantages are test code duplication and unnecessary test code will be
there if we use this 'lenient' keyword.
Yes the test works fine without it.
So I'm removing this lines.
```
when(mockJob.getTaskAttemptCompletionEvents(0, 100))
.thenReturn(taskEvents);
when(mockJob.getTaskAttemptCompletionEvents(0, 2))
.thenReturn(Arrays.copyOfRange(taskEvents, 0, 2));
when(mockJob.getTaskAttemptCompletionEvents(2, 100))
.thenReturn(Arrays.copyOfRange(taskEvents, 2, 4));
```
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]