### Question:
HistoryBlockImporter extends BaseBlockImporter<A, SwiftResultSet> { @Override protected Inserting getInserting(SegmentKey segKey) { ResourceLocation location = new ResourceLocation(new CubePathBuilder(segKey).setTempDir(CubeUtil.getCurrentDir(segKey.getTable())).build(), segKey.getStoreType()); Segment seg = new CacheColumnSegment(location, dataSource.getMetadata()); return new Inserting(SwiftInserter.ofOverwriteMode(seg), seg, 0); } HistoryBlockImporter(DataSource dataSource, A alloter);   }### Answer:
@Test public void getInserting() throws Exception { SegmentKey segKey = mock(SegmentKey.class, Mockito.RETURNS_DEEP_STUBS); mockStatic(CubeUtil.class); when(CubeUtil.getCurrentDir(segKey.getTable())).thenReturn(1); CubePathBuilder cubePathBuilder = mock(CubePathBuilder.class, Mockito.RETURNS_DEEP_STUBS); whenNew(CubePathBuilder.class).withArguments(segKey).thenReturn(cubePathBuilder); ResourceLocation location = mock(ResourceLocation.class); whenNew(ResourceLocation.class).withArguments( cubePathBuilder.setTempDir(CubeUtil.getCurrentDir(segKey.getTable())).build(), segKey.getStoreType()).thenReturn(location); DataSource dataSource = mock(DataSource.class, Mockito.RETURNS_DEEP_STUBS); CacheColumnSegment seg = mock(CacheColumnSegment.class); whenNew(CacheColumnSegment.class).withArguments(location, dataSource.getMetadata()).thenReturn(seg); SwiftInserter inserter = mock(SwiftInserter.class); mockStatic(SwiftInserter.class); when(SwiftInserter.ofOverwriteMode(seg)).thenReturn(inserter); HistoryBlockImporter<SwiftSourceAlloter<?, RowInfo>> historyBlockImporter = new HistoryBlockImporter<SwiftSourceAlloter<?, RowInfo>>(dataSource, mock(SwiftSourceAlloter.class)); Object inserting = historyBlockImporter.getInserting(segKey); assertEquals(inserter, Whitebox.getInternalState(inserting, "inserter")); assertEquals(seg, Whitebox.getInternalState(inserting, "seg")); assertEquals(0, (int) Whitebox.getInternalState(inserting, "rowCount")); }