public void testCategoryPolicies() {
FacetIndexingParams dfip = new DefaultFacetIndexingParams();
long seed = System.currentTimeMillis();
// check path policy
CategoryPath cp = new CategoryPath();
PathPolicy pathPolicy = new DefaultPathPolicy();
assertEquals("path policy does not match default for root" + "(seed "
+ seed + ")", pathPolicy.shouldAdd(cp), dfip.getPathPolicy()
.shouldAdd(cp));
for (int i = 0; i < 30; i++) {
int nComponents = random.nextInt(10);
String[] components = new String[nComponents];
for (int j = 0; j < components.length; j++) {
components[j] = (Integer.valueOf(random.nextInt(30))).toString();
}
cp = new CategoryPath(components);
assertEquals("path policy does not match default for "
+ cp.toString('/') + "(seed " + seed + ")", pathPolicy
.shouldAdd(cp), dfip.getPathPolicy().shouldAdd(cp));
}
// check ordinal policy
OrdinalPolicy ordinalPolicy = new DefaultOrdinalPolicy();