final Object otherStructure = doRoundTrip(structure);
assertEquals(structure, otherStructure);
}
public void testNestedStructure() throws Exception {
final ImmutableStructureValue structure = (ImmutableStructureValue)
unmarshall(getResourceAsString("res/nested-structure.xml"),
ImmutableStructureValueImpl.class);
// check the created object
final Map expectedFields = new HashMap();
final MutableStructureValueImpl structureValue =
new MutableStructureValueImpl();
final MutableStringValue value = new MutableStringValueImpl();
value.setValue("1/A Value");
structureValue.addField(new StructureFieldValue("sub1",
(MetaDataValue) value.createImmutable()));
value.setValue("1/B Value");
structureValue.addField(new StructureFieldValue("sub2",
(MetaDataValue) value.createImmutable()));
expectedFields.put("first", structureValue);
value.setValue("Second Value");
expectedFields.put("second", value.createImmutable());
assertEquals(expectedFields, structure.getFieldValuesAsMap());
final Object otherStructure = doRoundTrip(structure);
assertEquals(structure, otherStructure);
}