use of org.camunda.bpm.engine.form.FormProperty in project camunda-bpm-platform by camunda.
the class FormServiceTest method testFormPropertyDetails.
@SuppressWarnings("unchecked")
@Deployment
@Test
public void testFormPropertyDetails() {
String procDefId = repositoryService.createProcessDefinitionQuery().singleResult().getId();
StartFormData startFormData = formService.getStartFormData(procDefId);
FormProperty property = startFormData.getFormProperties().get(0);
assertEquals("speaker", property.getId());
assertNull(property.getValue());
assertTrue(property.isReadable());
assertTrue(property.isWritable());
assertFalse(property.isRequired());
assertEquals("string", property.getType().getName());
property = startFormData.getFormProperties().get(1);
assertEquals("start", property.getId());
assertNull(property.getValue());
assertTrue(property.isReadable());
assertTrue(property.isWritable());
assertFalse(property.isRequired());
assertEquals("date", property.getType().getName());
assertEquals("dd-MMM-yyyy", property.getType().getInformation("datePattern"));
property = startFormData.getFormProperties().get(2);
assertEquals("direction", property.getId());
assertNull(property.getValue());
assertTrue(property.isReadable());
assertTrue(property.isWritable());
assertFalse(property.isRequired());
assertEquals("enum", property.getType().getName());
Map<String, String> values = (Map<String, String>) property.getType().getInformation("values");
Map<String, String> expectedValues = new LinkedHashMap<String, String>();
expectedValues.put("left", "Go Left");
expectedValues.put("right", "Go Right");
expectedValues.put("up", "Go Up");
expectedValues.put("down", "Go Down");
// ACT-1023: check if ordering is retained
Iterator<Entry<String, String>> expectedValuesIterator = expectedValues.entrySet().iterator();
for (Entry<String, String> entry : values.entrySet()) {
Entry<String, String> expectedEntryAtLocation = expectedValuesIterator.next();
assertEquals(expectedEntryAtLocation.getKey(), entry.getKey());
assertEquals(expectedEntryAtLocation.getValue(), entry.getValue());
}
assertEquals(expectedValues, values);
}
Aggregations