DDMFormFieldTypesJSONSerializer implements DDMFormFieldTypesSerializer { @Override public DDMFormFieldTypesSerializerSerializeResponse serialize( DDMFormFieldTypesSerializerSerializeRequest ddmFormFieldTypesSerializerSerializeRequest) { List<DDMFormFieldType> ddmFormFieldTypes = ddmFormFieldTypesSerializerSerializeRequest.getDdmFormFieldTypes(); JSONArray jsonArray = _jsonFactory.createJSONArray(); try { for (DDMFormFieldType ddmFormFieldType : ddmFormFieldTypes) { jsonArray.put(toJSONObject(ddmFormFieldType)); } } catch (Exception exception) { if (_log.isWarnEnabled()) { _log.warn(exception, exception); } } DDMFormFieldTypesSerializerSerializeResponse.Builder builder = DDMFormFieldTypesSerializerSerializeResponse.Builder.newBuilder( jsonArray.toJSONString()); return builder.build(); }  @Override DDMFormFieldTypesSerializerSerializeResponse serialize(
		DDMFormFieldTypesSerializerSerializeRequest
			ddmFormFieldTypesSerializerSerializeRequest);  }
@Test public void testSerializationWithEmptyParameterList() throws Exception { List<DDMFormFieldType> ddmFormFieldTypes = Collections.emptyList(); String actualJSON = serialize(ddmFormFieldTypes); Assert.assertEquals("[]", actualJSON); }
@Test public void testSerializationWithNonemptyParameterList() throws Exception { List<DDMFormFieldType> ddmFormFieldTypes = new ArrayList<>(); DDMFormFieldType ddmFormFieldType = getMockedDDMFormFieldType(); ddmFormFieldTypes.add(ddmFormFieldType); String actualJSON = serialize(ddmFormFieldTypes); JSONAssert.assertEquals(createExpectedJSON(), actualJSON, false); }