Lucene.Net.Index.TestCompoundFile.TestReadPastEOF C# (CSharp) Method

TestReadPastEOF() private method

private TestReadPastEOF ( ) : void
return void
        public virtual void TestReadPastEOF()
        {
            SetUp_2();
            var cr = new CompoundFileDirectory(Dir, "f.comp", NewIOContext(Random()), false);
            IndexInput @is = cr.OpenInput("f2", NewIOContext(Random()));
            @is.Seek(@is.Length() - 10);
            var b = new byte[100];
            @is.ReadBytes(b, 0, 10);

            try
            {
                @is.ReadByte();
                Assert.Fail("Single byte read past end of file");
            }
            catch (IOException e)
            {
                /* success */
                //System.out.println("SUCCESS: single byte read past end of file: " + e);
            }

            @is.Seek(@is.Length() - 10);
            try
            {
                @is.ReadBytes(b, 0, 50);
                Assert.Fail("Block read past end of file");
            }
            catch (IOException e)
            {
                /* success */
                //System.out.println("SUCCESS: block read past end of file: " + e);
            }

            @is.Dispose();
            cr.Dispose();
        }