public void testMaxLengthToReader() { Configuration conf = new Configuration(); OrcProto.Type rowType = OrcProto.Type.CreateBuilder() .SetKind(OrcProto.Type.Types.Kind.STRUCT).Build(); OrcProto.Footer footer = OrcProto.Footer.CreateBuilder() .SetHeaderLength(0).SetContentLength(0).SetNumberOfRows(0) .SetRowIndexStride(0).AddTypes(rowType).Build(); OrcProto.PostScript ps = OrcProto.PostScript.CreateBuilder() .SetCompression(OrcProto.CompressionKind.NONE) .SetFooterLength((ulong)footer.SerializedSize) .SetMagic("ORC").AddVersion(0).AddVersion(11).Build(); DataOutputBuffer buffer = new DataOutputBuffer(); footer.WriteTo(buffer); ps.WriteTo(buffer); buffer.write(ps.SerializedSize); FileSystem fs = Mockito.mock(typeof(FileSystem), settings); FSDataInputStream file = new FSDataInputStream(new BufferInStream(buffer.getData(), buffer.getLength())); string p = "/dir/file.orc"; Mockito.when(fs.open(p)).thenReturn(file); OrcFile.ReaderOptions options = OrcFile.readerOptions(conf); options.filesystem(fs); options.maxLength(buffer.getLength()); Mockito.when(fs.getFileStatus(p)) .thenReturn(new FileStatus(10, false, 3, 3000, 0, p)); Reader reader = OrcFile.createReader(p, options); }