[
https://issues.apache.org/jira/browse/HDDS-12472?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17933293#comment-17933293
]
Chia-Chuan Yu commented on HDDS-12472:
--------------------------------------
HI, [~weichiu] [~adoroszlai]
Since there are so many occurrences in the code base, would it be better to
spit into sub tasks(maybe by module)?
Thanks!
> Use Mockito doReturn whenever possible
> --------------------------------------
>
> Key: HDDS-12472
> URL: https://issues.apache.org/jira/browse/HDDS-12472
> Project: Apache Ozone
> Issue Type: Improvement
> Reporter: Wei-Chiu Chuang
> Assignee: Chia-Chuan Yu
> Priority: Minor
>
> We are not use Mockito to stub method correctly.
> A lot of places we write in this pattern: when(xxx.yyy()).thenReturn(zzz),
> when it's less error-prone to write in doReturn(zzz).when(xxx).yyy();
> https://wesalvaro.medium.com/mockitos-sinister-silent-stub-secret-eeef5e5f6ec1
> here is one example where using it incorrectly throws weird exceptions. I
> encountered one in TestOMKeyRequest because of the spy object
> omSnapshotManager.
> Also check out
> https://stackoverflow.com/questions/20353846/mockito-difference-between-doreturn-and-when
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]