### Question:
TableCountTask implements ReconOmTask { @Override public Pair<String, Boolean> reprocess(OMMetadataManager omMetadataManager) { for (String tableName : getTaskTables()) { Table table = omMetadataManager.getTable(tableName); try (TableIterator keyIter = table.iterator()) { long count = getCount(keyIter); ReconUtils.upsertGlobalStatsTable(sqlConfiguration, globalStatsDao, getRowKeyFromTable(tableName), count); } catch (IOException ioEx) { LOG.error("Unable to populate Table Count in Recon DB.", ioEx); return new ImmutablePair<>(getTaskName(), false); } } LOG.info("Completed a 'reprocess' run of TableCountTask."); return new ImmutablePair<>(getTaskName(), true); } @Inject  TableCountTask(GlobalStatsDao globalStatsDao,
                        Configuration sqlConfiguration,
                        ReconOMMetadataManager reconOMMetadataManager); @Override Pair<String, Boolean> reprocess(OMMetadataManager omMetadataManager); @Override String getTaskName(); @Override Collection<String> getTaskTables(); @Override Pair<String, Boolean> process(OMUpdateEventBatch events); static String getRowKeyFromTable(String tableName);  }### Answer:
@Test public void testReprocess() { OMMetadataManager omMetadataManager = mock(OmMetadataManagerImpl.class); for (String tableName: tableCountTask.getTaskTables()) { TypedTable<String, Object> table = mock(TypedTable.class); TypedTable.TypedTableIterator mockIter = mock(TypedTable .TypedTableIterator.class); when(table.iterator()).thenReturn(mockIter); when(omMetadataManager.getTable(tableName)).thenReturn(table); when(mockIter.hasNext()) .thenReturn(true) .thenReturn(true) .thenReturn(true) .thenReturn(true) .thenReturn(true) .thenReturn(false); } Pair<String, Boolean> result = tableCountTask.reprocess(omMetadataManager); assertTrue(result.getRight()); assertEquals(5L, getCountForTable(KEY_TABLE)); assertEquals(5L, getCountForTable(VOLUME_TABLE)); assertEquals(5L, getCountForTable(BUCKET_TABLE)); assertEquals(5L, getCountForTable(OPEN_KEY_TABLE)); assertEquals(5L, getCountForTable(DELETED_TABLE)); }