Exemplo n.º 1
0
 @Test
 public void testclose() {
   try (FileInput instance = new FileInput(testsFileName)) {
     instance.readLine();
     instance.readLine();
     instance.close();
     try {
       instance.readLine();
       fail(
           "Expected IOException to be thrown after using a method on a closed FileInput object.");
     } catch (IOException ex) {
       // we expect an IOException to be caught here because the FileInput object is closed when
       // the readLine
       // method is called.
     }
   } catch (IOException ex) {
     fail("Caught IOException in testClose()");
   }
 }