[ 
https://issues.apache.org/jira/browse/HDDS-12472?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Chia-Chuan Yu reassigned HDDS-12472:
------------------------------------

    Assignee: Chia-Chuan Yu

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

Reply via email to