public void testMapMarshalling() throws Exception { Map m1 = new HashMap(); Map m2 = new TreeMap(); Map m3 = new HashMap(); Map<Integer, GlobalTransaction> m4 = new FastCopyHashMap<Integer, GlobalTransaction>(); for (int i = 0; i < 10; i++) { JGroupsAddress jGroupsAddress = new JGroupsAddress(new IpAddress(1000 * i)); GlobalTransaction gtx = gtf.newGlobalTransaction(jGroupsAddress, false); m1.put(1000 * i, gtx); m2.put(1000 * i, gtx); m4.put(1000 * i, gtx); } Map m5 = Immutables.immutableMapWrap(m3); marshallAndAssertEquality(m1); marshallAndAssertEquality(m2); byte[] bytes = marshaller.objectToByteBuffer(m4); Map<Integer, GlobalTransaction> m4Read = (Map<Integer, GlobalTransaction>) marshaller.objectFromByteBuffer(bytes); for (Map.Entry<Integer, GlobalTransaction> entry : m4.entrySet()) { assert m4Read.get(entry.getKey()).equals(entry.getValue()) : "Writen[" + entry.getValue() + "] and read[" + m4Read.get(entry.getKey()) + "] objects should be the same"; } marshallAndAssertEquality(m5); }