// write it, both via DataReaderWriter and Tuple.readFields
TupleFactory tf = TupleFactory.getInstance();
Tuple t1 = tf.newTuple(1);
InternalMap map = new InternalMap(2);
map.put(new Integer(1), new String("world"));
map.put(new Long(3L), new String("all"));
t1.set(0, map);
File file = File.createTempFile("Tuple", "put");
FileOutputStream fos = new FileOutputStream(file);
DataOutput out = new DataOutputStream(fos);
t1.write(out);
fos.close();
FileInputStream fis = new FileInputStream(file);
DataInput in = new DataInputStream(fis);
Tuple after = tf.newTuple();
after.readFields(in);
Object o = after.get(0);
assertTrue("isa InternalMap", o instanceof InternalMap);
InternalMap m = (InternalMap)o;
assertEquals("world", (String)m.get(new Integer(1)));
assertEquals("all", (String)m.get(new Long(3L)));
assertNull(m.get("fred"));
file.delete();
}