@Test
public void testProcessDDMFormInstanceReportWithExistingData()
	throws Exception {

	DDMFormFieldValue ddmFormFieldValue = _mockDDMFormFieldValue(
		"field1", "3");
	long formInstanceRecordId = 0;
	_mockDDMFormInstanceRecord(formInstanceRecordId);
	JSONObject processedFieldJSONObject =
		_numericDDMFormFieldTypeReportProcessor.process(
			ddmFormFieldValue,
			JSONUtil.put(
				"summary",
				JSONUtil.put(
					"average", "1"
				).put(
					"max", "1"
				).put(
					"min", "1"
				).put(
					"sum", "1"
				)
			).put(
				"totalEntries", 1
			).put(
				"type", DDMFormFieldType.NUMERIC
			).put(
				"values",
				JSONUtil.put(
					JSONUtil.put(
						"formInstanceRecordId", 1
					).put(
						"value", "1"
					))
			),
			formInstanceRecordId,
			DDMFormInstanceReportConstants.EVENT_ADD_RECORD_VERSION);
	JSONObject summaryJSONObject = processedFieldJSONObject.getJSONObject(
		"summary");
	Assert.assertEquals("2", summaryJSONObject.getString("average"));
	Assert.assertEquals("3", summaryJSONObject.getString("max"));
	Assert.assertEquals("1", summaryJSONObject.getString("min"));
	Assert.assertEquals("4", summaryJSONObject.getString("sum"));
}