@SuppressWarnings("unchecked")
@Test
public void testSerializeAndDeserializeNonEmpty() throws IOException {

  DataOutputBuffer out = new DataOutputBuffer();
  ObjectWritable.writeObject(out, nonEmptyFlagWritable, nonEmptyFlagWritable
      .getClass(), null);
  DataInputBuffer in = new DataInputBuffer();
  in.reset(out.getData(), out.getLength());
  EnumSet<TestEnumSet> read = ((EnumSetWritable<TestEnumSet>) ObjectWritable
      .readObject(in, null)).get();
  assertEquals(read, nonEmptyFlag);
}