	@Test
	public void testUserSubmissionMapToEntryValidComplex() throws MappingException, JsonProcessingException
	{

		setupMockService();

		SubmissionFormTemplate template = new SubmissionFormTemplate();
		template.setSections(new ArrayList<>());
		SubmissionFormSection section = new SubmissionFormSection();
		section.setFields(new ArrayList<>());

		SubmissionFormField submissionFormField = new SubmissionFormField();
		submissionFormField.setMappingType(SubmissionFormFieldMappingType.COMPONENT);
		submissionFormField.setFieldName(Component.FIELD_NAME);
		submissionFormField.setFieldId("NAME");
		section.getFields().add(submissionFormField);

		submissionFormField = new SubmissionFormField();
		submissionFormField.setMappingType(SubmissionFormFieldMappingType.COMPONENT);
		submissionFormField.setFieldName(Component.FIELD_ORGANIZATION);
		submissionFormField.setFieldId("ORG");
		section.getFields().add(submissionFormField);

		submissionFormField = new SubmissionFormField();
		submissionFormField.setMappingType(SubmissionFormFieldMappingType.COMPONENT);
		submissionFormField.setFieldName(Component.FIELD_DESCRIPTION);
		submissionFormField.setFieldId("DESCR");
		section.getFields().add(submissionFormField);

		submissionFormField = new SubmissionFormField();
		submissionFormField.setMappingType(SubmissionFormFieldMappingType.COMPLEX);
		submissionFormField.setFieldType(SubmissionFormFieldType.CONTACT);
		submissionFormField.setFieldId("CONTACT");
		section.getFields().add(submissionFormField);

		template.getSections().add(section);

		MappingController instance = new MappingController();

		UserSubmission userSubmission = new UserSubmission();
		userSubmission.setComponentType(TEST);
		userSubmission.setFields(new ArrayList<>());

		UserSubmissionField field = new UserSubmissionField();
		field.setTemplateFieldId("NAME");
		field.setRawValue("Apple");
		userSubmission.getFields().add(field);

		field = new UserSubmissionField();
		field.setTemplateFieldId("ORG");
		field.setRawValue("Org-Test");
		userSubmission.getFields().add(field);

		field = new UserSubmissionField();
		field.setTemplateFieldId("DESCR");
		field.setRawValue("Org-Test");
		userSubmission.getFields().add(field);

		field = new UserSubmissionField();
		field.setTemplateFieldId("CONTACT");

		ComponentContact contact = new ComponentContact();
		contact.setFirstName("Bob");
		contact.setLastName("test");
		contact.setEmail("bob@test.com");

		List<ComponentContact> allContacts = new ArrayList<>();
		allContacts.add(contact);
		ObjectMapper objectMapper = StringProcessor.defaultObjectMapper();
		String contactJson = objectMapper.writeValueAsString(allContacts);

		field.setRawValue(contactJson);
		userSubmission.getFields().add(field);

		ComponentFormSet componentFormSet = instance.mapUserSubmissionToEntry(template, userSubmission);
		assertTrue(componentFormSet.getPrimary().getContacts().get(0).getFirstName().equals("Bob"));
	}