FieldConverter implements Converter { @Override public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext context) { String id = reader.getAttribute(metadata.xmlFieldAttributeId); int start = Integer.valueOf(reader.getAttribute(metadata.xmlFieldAttributeStart)) - 1; int length = Integer.valueOf(reader.getAttribute(metadata.xmlFieldAttributeLength)); boolean isComposite = metadata.xmlFieldValueCompositeType .equalsIgnoreCase(reader.getAttribute(metadata.xmlFieldAttributeType)); boolean isInput = "true".equalsIgnoreCase(reader.getAttribute(metadata.xmlFieldAttributeInput)); String alias = reader.getAttribute(metadata.xmlFieldAttributeAlias); boolean whitespace = "true".equalsIgnoreCase(reader.getAttribute(metadata.xmlFieldAttributeWhitespace)); Field field = new Field(id, start, length, isComposite, isInput, alias, whitespace); log.debug("Created {}", field); return field; } FieldConverter(Metadata metadata); @Override boolean canConvert(@SuppressWarnings("rawtypes") Class type); @Override void marshal(Object source, HierarchicalStreamWriter writer, MarshallingContext context); @Override Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext context);  }
@Test public void testUnmarshal_compositeType() { prepareReaderMock(this.type); Field result = (Field) this.converter.unmarshal(readerMock, contextMock); assertFieldResult(true, result); }
@Test public void testUnmarshal_regularType() { prepareReaderMock("REG"); Field result = (Field) this.converter.unmarshal(readerMock, contextMock); assertFieldResult(false, result); }
@Test public void testUnmarshal_nullType() { prepareReaderMock(null); Field result = (Field) this.converter.unmarshal(readerMock, contextMock); assertFieldResult(false, result); }