@Test
  public void testFileObject() throws Exception {
    File file = new File(System.getProperty("user.dir"));

    DataOutputStream out = getDataOutput();
    DataSerializer.writeObject(file, out);
    out.flush();

    DataInput in = getDataInput();
    File file2 = DataSerializer.readObject(in);
    assertEquals(file, file2);
  }
Tests data serializing a {@link File} using {@link DataSerializer#writeObject}.
geode-core/src/test/java/org/apache/geode/internal/DataSerializableJUnitTest.java