public void testTwoEmptyAndNonEmptyByteArrays() throws Exception {
Directory indexDir = newDirectory();
Directory taxoDir = newDirectory();
EnhancementsIndexingParams indexingParams =
new DefaultEnhancementsIndexingParams(
new CategoryEnhancementDummy1(),
new CategoryEnhancementDummy3());
// add document with a category containing data for both enhancements
List<CategoryPath> categoryPaths = new ArrayList<CategoryPath>();
categoryPaths.add(new CategoryPath("a", "b"));
RandomIndexWriter indexWriter = new RandomIndexWriter(random, indexDir, newIndexWriterConfig(
TEST_VERSION_CURRENT, new MockAnalyzer(random, MockTokenizer.WHITESPACE, false)));
TaxonomyWriter taxo = new DirectoryTaxonomyWriter(taxoDir);
// a category document builder will add the categories to a document
// once build() is called
Document doc = new Document();
indexWriter.addDocument(new EnhancementsDocumentBuilder(taxo,
indexingParams).setCategoryPaths(categoryPaths).build(doc));
IndexReader indexReader = indexWriter.getReader();
indexWriter.close();
Term term = DrillDown.term(indexingParams, new CategoryPath("a","b"));
EnhancementsPayloadIterator iterator = new EnhancementsPayloadIterator(
indexingParams.getCategoryEnhancements(), indexReader, term);
assertTrue("EnhancementsPayloadIterator failure", iterator.init());
assertTrue("Missing document 0", iterator.setdoc(0));
assertNull("Unexpected data for CategoryEnhancementDummy2", iterator
.getCategoryData(new CategoryEnhancementDummy1()));