DerefMapSerializationUtil { byte[] serializeVariantPropertiesPattern(DerefMapVariantPropertiesPattern variantPropertiesPattern) throws IOException { final DataOutput dataOutput = new DataOutputImpl(); dataOutput.writeInt(variantPropertiesPattern.pattern.size()); for (Map.Entry<String, String> patternEntry : variantPropertiesPattern.pattern.entrySet()) { final String name = patternEntry.getKey(); dataOutput.writeUTF(name); final String value = patternEntry.getValue(); dataOutput.writeUTF(value); } return dataOutput.toByteArray(); } DerefMapSerializationUtil(IdGenerator idGenerator); Set<SchemaId> deserializeFields(byte[] serialized, int offset, int length);  }
@Test public void serializeVariantPropertiesPattern() throws Exception { final HashMap<String, String> pattern = new HashMap<String, String>(); pattern.put("foo", null); pattern.put("bar", "x"); final DerefMapVariantPropertiesPattern variantPropertiesPattern = new DerefMapVariantPropertiesPattern(pattern); final DerefMapVariantPropertiesPattern deserialized = serializationUtil.deserializeVariantPropertiesPattern( serializationUtil.serializeVariantPropertiesPattern(variantPropertiesPattern)); Assert.assertEquals(variantPropertiesPattern, deserialized); }