public void testDetectClose() throws Throwable {
  Directory dir=getDirectory(createTempDir("testDetectClose"));
  dir.close();
  expectThrows(AlreadyClosedException.class,null);
}

public void testDetectClose ( ) throws Throwable { Directory dir = getDirectory ( createTempDir ( "testDetectClose" ) ) ; dir . close ( ) ; expectThrows ( AlreadyClosedException . class , null ) ; }
make sure directory throws alreadyclosedexception if you try to createoutput after closing .
