[
https://issues.apache.org/jira/browse/HDDS-17764?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18142235#comment-18142235
]
Tsz-wo Sze edited comment on HDDS-17764 at 11/10/26, 6:39 PM:
--------------------------------------------------------------
bq. ... renaming them to Stub or Fake if you prefer.
Fake is okay. Stub is bad since it is used by gRPC. I ask AI a little bit:
- This is for test classes:
!screenshot-1.png|width=600!
- For DatanodeDetails case, it suggests
-- (1) using "Builder" or "TestData" suffixes.
!screenshot-2.png|width=600!
-- (2) The Object Mother Pattern
!image-2026-11-10-10-36-43-408.png|width=600!
-- (3) The Anonymous Generator Pattern, i.e. "Generator" or "TestUtils" suffix
!image-2026-11-10-10-37-24-470.png|width=600!
- How about "MockDatanodeDetails"? AI: "No, it is best to avoid naming this
class MockDatanodeDetails."
!screenshot-3.png|width=600!
was (Author: szetszwo):
bq. ... renaming them to Stub or Fake if you prefer.
Fake is okay. Stub is bad since it is used by gRPC. I ask AI a little bit:
- This is for test classes:
!screenshot-1.png|width=600!
- For DatanodeDetails case, it suggests
-- (1) using "Builder" or "TestData" suffixes.
!screenshot-2.png|width=600!
-- (2) The Object Mother Pattern
!image-2026-11-10-10-36-43-408.pngwidth=600!
-- (3) The Anonymous Generator Pattern, i.e. "Generator" or "TestUtils" suffix
!image-2026-11-10-10-37-24-470.png|width=600!
- How about "MockDatanodeDetails"? AI: "No, it is best to avoid naming this
class MockDatanodeDetails."
!screenshot-3.png|width=600!
> 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: image-2026-11-10-10-36-43-408.png,
> image-2026-11-10-10-37-24-470.png, 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]