DDMDataProviderInstanceParameterSettingsServlet extends BaseDDMFormBuilderServlet { protected JSONObject createParametersJSONObject( DDMDataProvider ddmDataProvider, DDMFormValues ddmFormValues) throws Exception { JSONObject parametersJSONObject = _jsonFactory.createJSONObject(); if (!ClassUtil.isSubclass( ddmDataProvider.getSettings(), DDMDataProviderParameterSettings.class)) { return parametersJSONObject; } DDMDataProviderParameterSettings ddmDataProviderParameterSetting = (DDMDataProviderParameterSettings)DDMFormInstanceFactory.create( ddmDataProvider.getSettings(), ddmFormValues); parametersJSONObject.put( "inputs", getInputParametersJSONArray( ddmDataProviderParameterSetting.inputParameters()) ).put( "outputs", getOutputParametersJSONArray( ddmDataProviderParameterSetting.outputParameters()) ); return parametersJSONObject; }    }
@Test public void testCreateParametersJSONObject() throws Exception { JSONObject parametersJSONObject = _ddmDataProviderInstanceParameterSettingsServlet. createParametersJSONObject( _ddmDataProvider, getDataProviderFormValues( "form-values-data-provider-settings-1.json")); String expectedValue = read( "data-provider-input-output-parameters-1.json"); JSONAssert.assertEquals( expectedValue, parametersJSONObject.toString(), false); }