use of org.apache.lucene.store.RAMOutputStream in project lucene-solr by apache.
the class TestCodecUtil method testReadHeaderWrongMagic.
public void testReadHeaderWrongMagic() throws Exception {
RAMFile file = new RAMFile();
IndexOutput output = new RAMOutputStream(file, true);
output.writeInt(1234);
output.close();
IndexInput input = new RAMInputStream("file", file);
expectThrows(CorruptIndexException.class, () -> {
CodecUtil.checkHeader(input, "bogus", 1, 1);
});
}
use of org.apache.lucene.store.RAMOutputStream in project lucene-solr by apache.
the class TestCodecUtil method testWriteTooLongHeader.
public void testWriteTooLongHeader() throws Exception {
StringBuilder tooLong = new StringBuilder();
for (int i = 0; i < 128; i++) {
tooLong.append('a');
}
RAMFile file = new RAMFile();
IndexOutput output = new RAMOutputStream(file, true);
expectThrows(IllegalArgumentException.class, () -> {
CodecUtil.writeHeader(output, tooLong.toString(), 5);
});
}
Aggregations