[
https://issues.apache.org/jira/browse/HDDS-17764?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18142172#comment-18142172
]
Tsz-wo Sze edited comment on HDDS-17764 at 11/10/26, 6:12 PM:
--------------------------------------------------------------
bq. ... since they do not reference real datanodes, addresses are random, etc.
I would say that the content is fake but the objects are real (in the sense of
Java). If "Mock" is not already used by Mockito, I am fine using (and we
should use it consistently).
bq. we would never possibly have classes named Mock... by following this logic,
since Mockito provides generic mocking
In TestOzoneFileSystemHeadOp, there is a MockAdapterFs which is correctly named
with "Mock" since its adapter field is a mock object by Mockito.
bq. we have too many ...TestUtils classes
This is a different problem. IMO, any classes related to testing are better to
have "Test" in the names. When working on the main code, it becomes very easy
to distinguish them.
was (Author: szetszwo):
> ... since they do not reference real datanodes, addresses are random, etc.
I would say that the content is fake but the objects are real (in the sense of
Java). If "Mock" is not already used by Mockito, I am fine using (and we
should use it consistently).
> we would never possibly have classes named Mock... by following this logic,
> since Mockito provides generic mocking
In TestOzoneFileSystemHeadOp, there is a MockAdapterFs which is correctly named
with "Mock" since its adapter field is a mock object by Mockito.
> we have too many ...TestUtils classes
This is a different problem. IMO, any classes related to testing are better to
have "Test" in the names. When working on the main code, it becomes very easy
to distinguish them.
> MockDatanodeDetails and MockPipeline are not mocks.
> ---------------------------------------------------
>
> Key: HDDS-17764
> URL: https://issues.apache.org/jira/browse/HDDS-17764
> Project: Apache Ozone
> Issue Type: Improvement
> Components: test
> Reporter: Tsz-wo Sze
> Assignee: Andy Huang
> Priority: Minor
> Labels: pull-request-available
> Attachments: screenshot-1.png, screenshot-2.png, screenshot-3.png
>
>
> MockDatanodeDetails and MockPipeline are test utilities for creating *real*
> DatanodeDetails and Pipeline objects but not mock objects (in the sense of
> Mockito).
> Calling them "mock" is misleading. These two classes are better to be
> renamed to something like DatanodeDetailsTestUtils and PipelineTestUtils.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]