DDMFormValuesJSONSerializer implements DDMFormValuesSerializer { @Override public DDMFormValuesSerializerSerializeResponse serialize( DDMFormValuesSerializerSerializeRequest ddmFormValuesSerializerSerializeRequest) { DDMFormValues ddmFormValues = ddmFormValuesSerializerSerializeRequest.getDDMFormValues(); JSONObject jsonObject = _jsonFactory.createJSONObject(); addAvailableLanguageIds( jsonObject, ddmFormValues.getAvailableLocales()); addDefaultLanguageId(jsonObject, ddmFormValues.getDefaultLocale()); DDMForm ddmForm = ddmFormValues.getDDMForm(); addFieldValues( jsonObject, ddmForm.getDDMFormFieldsMap(true), ddmFormValues.getDDMFormFieldValues()); DDMFormValuesSerializerSerializeResponse.Builder builder = DDMFormValuesSerializerSerializeResponse.Builder.newBuilder( jsonObject.toString()); return builder.build(); }  @Override DDMFormValuesSerializerSerializeResponse serialize(
		DDMFormValuesSerializerSerializeRequest
			ddmFormValuesSerializerSerializeRequest);  }
@Test public void testFormValuesSerialization() throws Exception { String expectedJSON = read( "ddm-form-values-json-serializer-test-data.json"); DDMFormValues ddmFormValues = createDDMFormValues(); String actualJSON = serialize(ddmFormValues); JSONAssert.assertEquals(expectedJSON, actualJSON, false); }