private void validateModel(BpmnModel model) {
FlowElement flowElement = model.getMainProcess().getFlowElement("usertask");
assertNotNull(flowElement);
assertTrue(flowElement instanceof UserTask);
assertEquals("usertask", flowElement.getId());
UserTask userTask = (UserTask) flowElement;
assertEquals("usertask", userTask.getId());
assertEquals("User task", userTask.getName());
assertEquals("testKey", userTask.getFormKey());
assertEquals("40", userTask.getPriority());
assertEquals("2012-11-01", userTask.getDueDate());
assertEquals("defaultCategory", userTask.getCategory());
assertEquals("gonzo", userTask.getOwner());
assertEquals("kermit", userTask.getAssignee());
assertEquals(2, userTask.getCandidateUsers().size());
assertTrue(userTask.getCandidateUsers().contains("kermit"));
assertTrue(userTask.getCandidateUsers().contains("fozzie"));
assertEquals(2, userTask.getCandidateGroups().size());
assertTrue(userTask.getCandidateGroups().contains("management"));
assertTrue(userTask.getCandidateGroups().contains("sales"));
assertEquals(2, userTask.getCustomUserIdentityLinks().size());
assertEquals(1, userTask.getCustomGroupIdentityLinks().size());
assertTrue(userTask.getCustomUserIdentityLinks().get("bizAdmin").contains("kermit"));
assertTrue(userTask.getCustomGroupIdentityLinks().get("bizAdmin").contains("management"));
assertTrue(userTask.getCustomGroupIdentityLinks().get("bizAdmin").contains("sales"));
assertTrue(userTask.getCustomUserIdentityLinks().get("manager").contains("fozzie"));
assertTrue(userTask.getCustomUserIdentityLinks().get("manager").contains("gonzo"));
List<FormProperty> formProperties = userTask.getFormProperties();
assertEquals(2, formProperties.size());
FormProperty formProperty = formProperties.get(0);
assertEquals("formId", formProperty.getId());
assertEquals("formName", formProperty.getName());
assertEquals("string", formProperty.getType());
assertEquals("variable", formProperty.getVariable());
assertEquals("${expression}", formProperty.getExpression());
formProperty = formProperties.get(1);
assertEquals("formId2", formProperty.getId());
assertEquals("anotherName", formProperty.getName());
assertEquals("long", formProperty.getType());
assertTrue(StringUtils.isEmpty(formProperty.getVariable()));
assertTrue(StringUtils.isEmpty(formProperty.getExpression()));
List<ActivitiListener> listeners = userTask.getTaskListeners();
assertEquals(3, listeners.size());
ActivitiListener listener = (ActivitiListener) listeners.get(0);
assertTrue(ImplementationType.IMPLEMENTATION_TYPE_CLASS.equals(listener.getImplementationType()));
assertEquals("org.test.TestClass", listener.getImplementation());
assertEquals("create", listener.getEvent());