@Test
public void testWrite() throws Exception {

	DDMFormInstanceRecordJSONWriter ddmFormInstanceRecordJSONWriter =
		new DDMFormInstanceRecordJSONWriter();
	ddmFormInstanceRecordJSONWriter.jsonFactory = new JSONFactoryImpl();
	List<Map<String, String>> ddmFormFieldValues =
		new ArrayList<Map<String, String>>() {
			{
				add(
					HashMapBuilder.put(
						"field1", "2"
					).put(
						"field2", "false"
					).put(
						"field3", "11.7"
					).build());
				add(
					HashMapBuilder.put(
						"field1", "1"
					).put(
						"field2", ""
					).put(
						"field3", "10"
					).build());
			}
		};
	DDMFormInstanceRecordWriterRequest.Builder builder =
		DDMFormInstanceRecordWriterRequest.Builder.newBuilder(
			Collections.emptyMap(), ddmFormFieldValues);
	DDMFormInstanceRecordWriterResponse
		ddmFormInstanceRecordWriterResponse =
			ddmFormInstanceRecordJSONWriter.write(builder.build());
	StringBundler sb = new StringBundler(3);
	sb.append("[{\"field1\":\"2\",\"field3\":\"11.7\",\"field2\":");
	sb.append("\"false\"},{\"field1\":\"1\",\"field3\":\"10\",\"field2\":");
	sb.append("\"\"}]");
	String expectedJSON = sb.toString();
	Assert.assertArrayEquals(
		expectedJSON.getBytes(),
		ddmFormInstanceRecordWriterResponse.getContent());
}