@Test
  public void testFileOperations() throws Exception {
    String name1 = "testFile1";
    File file1 = system.createFile(name1);
    byte[] file1Data = writeRandomBytes(file1);

    String name2 = "testFile2";
    File file2 = system.createFile(name2);
    byte[] file2Data = writeRandomBytes(file2);

    file1 = system.getFile(name1);
    file2 = system.getFile(name2);

    assertEquals(Arrays.asList(name1, name2), system.listFileNames());
    assertContents(file1Data, file1);
    assertContents(file2Data, file2);


    try {
      system.renameFile(name1, name2);
      fail("Should have received an exception");
    } catch (IOException expected) {

    }
    assertEquals(Arrays.asList(name1, name2), system.listFileNames());
    assertContents(file1Data, file1);
    assertContents(file2Data, file2);

    String name3 = "testFile3";

    system.renameFile(name1, name3);

    File file3 = system.getFile(name3);

    assertEquals(Arrays.asList(name3, name2), system.listFileNames());
    assertContents(file1Data, file3);
    assertContents(file2Data, file2);

    system.deleteFile(name2);

    assertEquals(Arrays.asList(name3), system.listFileNames());

    system.renameFile(name3, name2);

    assertEquals(Arrays.asList(name2), system.listFileNames());

    file2 = system.getFile(name2);
    assertContents(file1Data, file2);
  }
Test basic file operations - rename, delete, listFiles.
geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/filesystem/FileSystemJUnitTest.java