/** * Copyright (c) 2000-present Liferay, Inc. All rights reserved. * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free * Software Foundation; either version 2.1 of the License, or (at your option) * any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more * details. */ package com.liferay.dynamic.data.mapping.type.grid.internal; import com.liferay.dynamic.data.mapping.model.DDMForm; import com.liferay.dynamic.data.mapping.model.DDMFormField; import com.liferay.dynamic.data.mapping.type.BaseDDMFormFieldTypeSettingsTestCase; import com.liferay.dynamic.data.mapping.util.DDMFormFactory; import com.liferay.portal.kernel.util.PortalClassLoaderUtil; import com.liferay.portal.kernel.util.ResourceBundleUtil; import java.util.Map; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; /** * @author Pedro Queiroz */ @PrepareForTest({PortalClassLoaderUtil.class, ResourceBundleUtil.class}) @RunWith(PowerMockRunner.class) public class GridDDMFormFieldTypeSettingsTest extends BaseDDMFormFieldTypeSettingsTestCase { @Test public void testCreateGridDDMFormFieldTypeSettingsDDMForm() { DDMForm ddmForm = DDMFormFactory.create( GridDDMFormFieldTypeSettings.class); Map<String, DDMFormField> ddmFormFieldsMap = ddmForm.getDDMFormFieldsMap(false); DDMFormField rowsDDMFormField = ddmFormFieldsMap.get("rows"); Assert.assertNotNull(rowsDDMFormField); Assert.assertEquals("ddm-options", rowsDDMFormField.getDataType()); Assert.assertNotNull(rowsDDMFormField.getLabel()); Assert.assertTrue(rowsDDMFormField.isRequired()); Assert.assertEquals("options", rowsDDMFormField.getType()); DDMFormField columnsDDMFormField = ddmFormFieldsMap.get("columns"); Assert.assertNotNull(columnsDDMFormField); Assert.assertEquals("ddm-options", columnsDDMFormField.getDataType()); Assert.assertNotNull(columnsDDMFormField.getLabel()); Assert.assertTrue(columnsDDMFormField.isRequired()); Assert.assertEquals("options", columnsDDMFormField.getType()); DDMFormField validationDDMFormField = ddmFormFieldsMap.get( "validation"); Assert.assertNotNull(validationDDMFormField); DDMFormField predefinedValueDDMFormField = ddmFormFieldsMap.get( "predefinedValue"); Assert.assertNotNull(predefinedValueDDMFormField); DDMFormField repeatableDDMFormField = ddmFormFieldsMap.get( "repeatable"); Assert.assertNotNull(repeatableDDMFormField); } }