### Question:
SwiftInserter extends BaseInserter implements Inserter { @Override public void insertData(Row rowData) { putRow(cursor, rowData); cursor++; } private  SwiftInserter(Segment segment, List<String> fields, boolean append); protected  SwiftInserter(Segment segment, boolean append); static SwiftInserter ofAppendMode(Segment seg); static SwiftInserter ofOverwriteMode(Segment seg); @Override void insertData(Row rowData); @Override @Transactional void insertData(SwiftResultSet resultSet); @Override void release();  }### Answer:
@Test public void insertData() throws Exception { SwiftResultSet resultSet = mock(SwiftResultSet.class); when(resultSet.hasNext()).thenReturn(true, true, true, false); when(resultSet.getNextRow()).thenReturn(new ListBasedRow(1), new ListBasedRow(new Object[]{null}), new ListBasedRow(7)); when(resultSet.getMetaData()).thenReturn(meta); SwiftInserter.ofOverwriteMode(segment).insertData(resultSet); Column<Object> c1 = segment.getColumn(new ColumnKey("c1")); DetailColumn<Object> detailColumn = c1.getDetailColumn(); BitmapIndexedColumn bitmapIndex = c1.getBitmapIndex(); verify(detailColumn).put(0, 1); verify(detailColumn).put(1, null); verify(detailColumn).put(2, 7); verify(resultSet).close(); verify(bitmapIndex).putNullIndex(argThat(new ArgumentMatcher<ImmutableBitMap>() { @Override public boolean matches(ImmutableBitMap item) { return item.getCardinality() == 1 && item.contains(1); } })); verify(segment).putRowCount(3); verify(segment).putAllShowIndex(argThat(new ArgumentMatcher<ImmutableBitMap>() { @Override public boolean matches(ImmutableBitMap item) { return item.getCardinality() == 3; } })); verifyStatic(SegmentUtils.class); SegmentUtils.releaseHisSeg(segment); }