### Question:
IndexerDryRun { int run() { long programStartTime = System.currentTimeMillis(); IndexingSpecification indexingSpec = indexingOpts.getIndexingSpecification(); IndexerComponentFactory factory = IndexerComponentFactoryUtil.getComponentFactory(indexingSpec.getIndexerComponentFactory(), new ByteArrayInputStream(indexingSpec.getConfiguration()), Maps.<String, String>newHashMap()); IndexerConf indexerConf = factory.createIndexerConf(); if (indexerConf.getRowReadMode() != RowReadMode.NEVER) { LOG.warn("Changing row read mode from " + indexerConf.getRowReadMode() + " to " + RowReadMode.NEVER); indexerConf = new IndexerConfBuilder(indexerConf).rowReadMode(RowReadMode.NEVER).build(); } Map<String, String> params = indexerConf.getGlobalParams(); if (indexingOpts.morphlineFile != null) { params.put(MorphlineResultToSolrMapper.MORPHLINE_FILE_PARAM, indexingOpts.morphlineFile.getPath()); } if (indexingOpts.morphlineId != null) { params.put(MorphlineResultToSolrMapper.MORPHLINE_ID_PARAM, indexingOpts.morphlineId); } for (Map.Entry<String, String> entry : hbaseConf) { if (entry.getKey().startsWith(MorphlineResultToSolrMapper.MORPHLINE_VARIABLE_PARAM + ".")) { params.put(entry.getKey(), entry.getValue()); } if (entry.getKey().startsWith(MorphlineResultToSolrMapper.MORPHLINE_FIELD_PARAM + ".")) { params.put(entry.getKey(), entry.getValue()); } } MorphlineClasspathUtil.setupJavaCompilerClasspath(); ResultToSolrMapper resultToSolrMapper = ResultToSolrMapperFactory.createResultToSolrMapper( indexingSpec.getIndexerName(), indexerConf); Indexer indexer = Indexer.createIndexer( indexingSpec.getIndexerName(), indexerConf, indexingSpec.getTableName(), resultToSolrMapper, null, null, documentWriter); Scan scan = indexingOpts.getScans().get(0); Table htable = null; Connection connection = null; try { connection = ConnectionFactory.createConnection(hbaseConf); htable = connection.getTable(TableName.valueOf(indexingSpec.getTableName())); ResultScanner scanner = htable.getScanner(scan); for (Result result : scanner) { indexer.indexRowData(ImmutableList.<RowData>of(new ResultWrappingRowData(result, indexingSpec.getTableName().getBytes(Charsets.UTF_8)))); } } catch (Exception e) { throw new RuntimeException(e); } finally { Closer.close(htable); if (connection != null) { try { connection.close(); } catch (IOException ioe) { ; } } } HBaseMapReduceIndexerTool.goodbye(null, programStartTime); return 0; } IndexerDryRun(HBaseIndexingOptions hbaseIndexingOpts, Configuration hbaseConf, OutputStream output);   }### Answer:
@Test public void testDryRun() throws IOException { writeHBaseRecord("row1", ImmutableMap.of( "firstname", "John", "lastname", "Doe")); writeHBaseRecord("row2", ImmutableMap.of( "firstname", "Jane", "lastname", "Doe")); opts.evaluate(); ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); IndexerDryRun dryRunner = new IndexerDryRun(opts, HBASE_TEST_UTILITY.getConfiguration(), outputStream); int exitCode = dryRunner.run(); String output = new String(outputStream.toByteArray()); assertEquals(3, Iterables.size(Splitter.on('\n').split(output))); assertEquals(0, exitCode); }