@Test
public void serializeAndDeserialize() throws IOException, ClassNotFoundException {

    final File tempFile = File.createTempFile("test", ".data");
    tempFile.deleteOnExit();
    final FileOutputStream outputFile = new FileOutputStream(tempFile.getPath());
    final ObjectOutputStream out = new ObjectOutputStream(outputFile);
    final Region unknownRegion = Region.register("foobar", Realm.OC1);
    out.writeObject(Region.US_PHOENIX_1);
    out.writeObject(unknownRegion);
    out.close();
    outputFile.close();
    final FileInputStream inputFile = new FileInputStream(tempFile.getPath());
    final ObjectInputStream in = new ObjectInputStream(inputFile);
    final Region region1 = (Region) in.readObject();
    final Region region2 = (Region) in.readObject();
    in.close();
    inputFile.close();
    assertEquals(Region.US_PHOENIX_1, region1);
    assertEquals(unknownRegion, region2);
}