@Test
public void testGapInGapFull() throws Exception {

    detector.setFullGapAnalysis(true);
    when(contextService.is(ContextConstants.ROUTING_FULL_GAP_ANALYSIS)).thenReturn(true);
    String sql = ArgumentMatchers.anyString();
    @SuppressWarnings("unchecked")
    ISqlRowMapper<Long> mapper = (ISqlRowMapper<Long>) ArgumentMatchers.any();
    when(sqlTemplate.query(sql, mapper, (Object[])ArgumentMatchers.any())).thenAnswer(new Answer<List<Long>>() {
        public List<Long> answer(InvocationOnMock invocation) {
            List<Long> dataIds = new ArrayList<Long>();
            long startId = (Long) invocation.getArguments()[2];
            long endId = (Long) invocation.getArguments()[3];
            if (startId == 5 && endId == 10) {
                dataIds.add(6L);                    
            } else if (startId == 15 && endId == 20) {
                dataIds.add(18L);
            } else if (startId == 21 && endId == 50000020) {
                dataIds.add(23L);
            }
            return dataIds;
        }
    });
    List<DataGap> dataGaps = new ArrayList<DataGap>();
    dataGaps.add(new DataGap(3, 3));
    dataGaps.add(new DataGap(5, 10));
    dataGaps.add(new DataGap(15, 20));
    dataGaps.add(new DataGap(21, 50000020));
    runGapDetector(dataGaps, new ArrayList<Long>(), true);
    Set<DataGap> deleted = new HashSet<DataGap>();
    deleted.add(new DataGap(5, 10));
    deleted.add(new DataGap(15, 20));
    deleted.add(new DataGap(21, 50000020));
    Set<DataGap> inserted = new HashSet<DataGap>();
    inserted.add(new DataGap(5, 5));
    inserted.add(new DataGap(7, 10));
    inserted.add(new DataGap(15, 17));
    inserted.add(new DataGap(19, 20));
    inserted.add(new DataGap(21, 22));
    inserted.add(new DataGap(24, 50000023));
    verify(dataService).findDataGaps();
    verify(dataService).deleteDataGaps(sqlTransaction, deleted);
    verify(dataService).insertDataGaps(sqlTransaction, inserted);        
    verifyNoMoreInteractions(dataService);
}