question: public void testRead1 ( ) throws Exception { byte [ ] data = new byte [ ] { - 127 , - 100 , - 50 , - 10 , - 1 , 0 , 1 , 10 , 50 , 127 } ; TestInputStream tis = new TestInputStream ( data ) ; CipherInputStream cis = new CipherInputStream ( tis , new NullCipher ( ) ) ; byte res ; for ( int i = 0 ; i < data . length ; i ++ ) { if ( ( res = ( byte ) cis . read ( ) ) != data [ i ] ) { fail ( "read() returned the incorrect value. " + "Expected: " + data [ i ] + ", Got: " + res + "." ) ; } } if ( cis . read ( ) != - 1 ) { fail ( "read() should return -1 at the end of the stream." ) ; } }
target:  read() method testing. Tests that method returns the correct value (related to the InputStream) and that it returns -1 at the end of stream.