gzhao9 opened a new pull request, #15980:
URL: https://github.com/apache/druid/pull/15980

   #### Description
   Fixes #15979
   
   This PR addresses the issue #15979 of duplicated mock creation code across 
multiple test classes within the Apache Druid project. By introducing the 
`CreateMockColumnValueSelector.java` utility class, I aim to centralize the 
creation of mocked `ColumnValueSelector` objects, thereby enhancing code 
reusability and simplifying maintenance.
   
   In the course of testing, particularly within the 
`ArrayDoubleGroupByColumnSelectorStrategyTest`, 
`ArrayLongGroupByColumnSelectorStrategyTest`, and 
`ArrayStringGroupByColumnSelectorStrategyTest` classes, I identified a pattern 
of duplicate code concerning mock object creation. This redundancy not only 
bloats the test code but also introduces unnecessary complexity.
   
   #### Solution
   
   The newly introduced `CreateMockColumnValueSelector` class provides a 
streamlined approach to generating mocked `ColumnValueSelector` instances, 
equipped with predefined behaviors. This approach significantly reduces the 
boilerplate code in our test suite and improves the readability and 
maintainability of our tests.
   
   
   
   #### Key changed/added classes in this PR
   
   - `CreateMockColumnValueSelector`
   - Modified:
     - `ArrayDoubleGroupByColumnSelectorStrategyTest`
     - `ArrayLongGroupByColumnSelectorStrategyTest`
     - `ArrayStringGroupByColumnSelectorStrategyTest`
   
   By doing this, code repetition can be reduced. Make the test code clearer
   I'd love to hear your thoughts on this proposal! Do you agree with any of 
these changes, or do you have other insights or preferences?


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

Reply via email to