DocumentLibraryDDMFormFieldValueAccessor implements DDMFormFieldValueAccessor<JSONObject> { @Override public boolean isEmpty(DDMFormFieldValue ddmFormFieldValue, Locale locale) { JSONObject valueJSONObject = getValue(ddmFormFieldValue, locale); if (valueJSONObject.length() == 0) { return true; } return false; }  @Override IntFunction<JSONObject[]> getArrayGeneratorIntFunction(); @Override JSONObject getValue(
		DDMFormFieldValue ddmFormFieldValue, Locale locale); @Override JSONObject getValueForEvaluation(
		DDMFormFieldValue ddmFormFieldValue, Locale locale); @Override boolean isEmpty(DDMFormFieldValue ddmFormFieldValue, Locale locale);  }
@Test public void testEmpty() { DDMFormFieldValue ddmFormFieldValue = DDMFormValuesTestUtil.createDDMFormFieldValue( "documentLibrary", new UnlocalizedValue("{}")); Assert.assertTrue( _documentLibraryDDMFormFieldValueAccessor.isEmpty( ddmFormFieldValue, LocaleUtil.US)); }
@Test public void testNotEmpty() { StringBundler sb = new StringBundler(4); sb.append("{\"groupId\":\"32964\","); sb.append("\"title\":\"Welcome to Liferay Forms!\","); sb.append("\"type\":\"document\","); sb.append("\"uuid\":\"f85c8ae1-603b-04eb-1132-12645d73519e\"}"); DDMFormFieldValue ddmFormFieldValue = DDMFormValuesTestUtil.createDDMFormFieldValue( "documentLibrary", new UnlocalizedValue(sb.toString())); Assert.assertFalse( _documentLibraryDDMFormFieldValueAccessor.isEmpty( ddmFormFieldValue, LocaleUtil.US)); }