kfaraz commented on code in PR #16682:
URL: https://github.com/apache/druid/pull/16682#discussion_r1668618039
##########
extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/theta/SketchAggregatorFactoryTest.java:
##########
@@ -46,6 +51,22 @@ public class SketchAggregatorFactoryTest
private static final SketchMergeAggregatorFactory AGGREGATOR_32768 =
new SketchMergeAggregatorFactory("x", "x", 32768, null, false, null);
+ private final ColumnSelectorFactory metricFactory =
EasyMock.mock(ColumnSelectorFactory.class);
+ private final VectorColumnSelectorFactory vectorFactory =
EasyMock.mock(VectorColumnSelectorFactory.class);
+ private final ColumnCapabilities capabilities =
EasyMock.mock(ColumnCapabilities.class);
+
+ @Before
+ public void setup()
+ {
+
EasyMock.expect(metricFactory.getColumnCapabilities(EasyMock.anyString())).andReturn(capabilities).anyTimes();
+
EasyMock.expect(vectorFactory.getColumnCapabilities(EasyMock.anyString())).andReturn(capabilities).anyTimes();
+
EasyMock.expect(capabilities.toColumnType()).andReturn(ColumnType.NESTED_DATA).anyTimes();
+ EasyMock.expect(capabilities.isArray()).andReturn(false).anyTimes();
+
EasyMock.expect(capabilities.is(EasyMock.eq(ValueType.COMPLEX))).andReturn(true).anyTimes();
+
EasyMock.expect(capabilities.asTypeString()).andReturn(ColumnType.NESTED_DATA.asTypeString()).anyTimes();
+ EasyMock.replay(metricFactory, vectorFactory, capabilities);
+ }
Review Comment:
+1, create mocks only for
- external (non Druid) dependencies
- OR Druid interfaces whose concrete impls live in a different module that
is not a parent of the current module
- OR complex Druid objects of which only a small subset of functionality is
needed in the test and it would be a lot of unnecessary work to use a concrete
instance
--
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]