### Question:
ActiveSyncDecoder implements SyncDefaultValues { public void appendInteger(Element root, ActiveSyncFields integerField, Integer value) { if (value != null) { DOMUtils.createElementAndText(root, integerField.getName(), value); } }  String uniqueStringFieldValue(Element root, ActiveSyncFields stringField); String requiredStringFieldValue(Element root, ActiveSyncFields stringField); Boolean uniqueBooleanFieldValue(Element root, ActiveSyncFields booleanField); boolean uniqueBooleanFieldValue(Element root, ActiveSyncFields booleanField, boolean defaultValue); Integer uniqueIntegerFieldValue(Element root, ActiveSyncFields integerField); Integer requiredIntegerFieldValue(Element root, ActiveSyncFields integerField); Long uniqueLongFieldValue(Element root, ActiveSyncFields longField); void appendBoolean(Element root, ActiveSyncFields booleanField, Boolean value); void appendInteger(Element root, ActiveSyncFields integerField, Integer value); void appendString(Element root, ActiveSyncFields stringField, String value); void appendElement(Element root, Element value);  }### Answer:
@Test public void testAppendIntegerWhenNull() throws Exception { Document doc = DOMUtils.createDoc(null, "root"); new ActiveSyncDecoder().appendInteger(doc.getDocumentElement(), field("FieldName"), null); assertThat(DOMUtils.serialize(doc)).isEqualTo(xml("<root/>")); }
@Test public void testAppendIntegerWhenMin() throws Exception { Document doc = DOMUtils.createDoc(null, "root"); new ActiveSyncDecoder().appendInteger(doc.getDocumentElement(), field("FieldName"), Integer.MIN_VALUE); assertThat(DOMUtils.serialize(doc)).isEqualTo(xml("<root><FieldName>-2147483648</FieldName></root>")); }
@Test public void testAppendIntegerWhenMax() throws Exception { Document doc = DOMUtils.createDoc(null, "root"); new ActiveSyncDecoder().appendInteger(doc.getDocumentElement(), field("FieldName"), Integer.MAX_VALUE); assertThat(DOMUtils.serialize(doc)).isEqualTo(xml("<root><FieldName>2147483647</FieldName></root>")); }
@Test public void testAppendIntegerWhenZero() throws Exception { Document doc = DOMUtils.createDoc(null, "root"); new ActiveSyncDecoder().appendInteger(doc.getDocumentElement(), field("FieldName"), 0); assertThat(DOMUtils.serialize(doc)).isEqualTo(xml("<root><FieldName>0</FieldName></root>")); }