try {
FieldCache.DEFAULT.getInts(ar, "binary", false);
fail();
} catch (IllegalStateException expected) {}
BinaryDocValues binary = FieldCache.DEFAULT.getTerms(ar, "binary", true);
binary.get(0, scratch);
assertEquals("binary value", scratch.utf8ToString());
try {
FieldCache.DEFAULT.getTermsIndex(ar, "binary");
fail();
} catch (IllegalStateException expected) {}
try {
FieldCache.DEFAULT.getDocTermOrds(ar, "binary");
fail();
} catch (IllegalStateException expected) {}
try {
new DocTermOrds(ar, null, "binary");
fail();
} catch (IllegalStateException expected) {}
Bits bits = FieldCache.DEFAULT.getDocsWithField(ar, "binary");
assertTrue(bits.get(0));
// Sorted type: can be retrieved via getTerms(), getTermsIndex(), getDocTermOrds()
try {
FieldCache.DEFAULT.getInts(ar, "sorted", false);
fail();
} catch (IllegalStateException expected) {}
try {
new DocTermOrds(ar, null, "sorted");
fail();
} catch (IllegalStateException expected) {}
binary = FieldCache.DEFAULT.getTerms(ar, "sorted", true);
binary.get(0, scratch);
assertEquals("sorted value", scratch.utf8ToString());
SortedDocValues sorted = FieldCache.DEFAULT.getTermsIndex(ar, "sorted");
assertEquals(0, sorted.getOrd(0));
assertEquals(1, sorted.getValueCount());