public class DefaultFacetIndexingParamsTest extends LuceneTestCase {
@Test
public void testDefaultSettings() {
FacetIndexingParams dfip = new DefaultFacetIndexingParams();
assertNotNull("Missing default category list", dfip
.getAllCategoryListParams());
assertEquals(
"all categories have the same CategoryListParams by default",
dfip.getCategoryListParams(null), dfip
.getCategoryListParams(new CategoryPath("a")));
assertEquals(
"Expected default category list term is $facets:$fulltree$",
new Term("$facets", "$fulltree$"), dfip.getCategoryListParams(
null).getTerm());
String expectedDDText = "a"
+ dfip.getFacetDelimChar() + "b";
CategoryPath cp = new CategoryPath("a", "b");
assertEquals("wrong drill-down term", new Term("$facets",
expectedDDText), DrillDown.term(dfip,cp));
char[] buf = new char[20];
int numchars = dfip.drillDownTermText(cp, buf);
assertEquals("3 characters should be written", 3, numchars);
assertEquals("wrong drill-down term text", expectedDDText, new String(
buf, 0, numchars));
CategoryListParams clParams = dfip.getCategoryListParams(null);
assertEquals("partition for all ordinals is the first", "$fulltree$",
PartitionsUtils.partitionNameByOrdinal(dfip, clParams , 250));
assertEquals("for partition 0, the same name should be returned",
"$fulltree$", PartitionsUtils.partitionName(clParams, 0));
assertEquals(
"for any other, it's the concatenation of name + partition",
"$fulltree$1", PartitionsUtils.partitionName(clParams, 1));
assertEquals("default partition number is always 0", 0,
PartitionsUtils.partitionNumber(dfip,100));
assertEquals("default partition size is unbounded", Integer.MAX_VALUE,
dfip.getPartitionSize());
}