<commit_before><commit_msg>Adding Test Class for EditParticipantController<commit_after>package edu.duke.cabig.c3pr.web;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

import org.apache.xbean.spring.context.ClassPathXmlApplicationContext;
import org.springframework.context.ApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;
import org.springframework.web.servlet.ModelAndView;

import edu.duke.cabig.c3pr.dao.HealthcareSiteDao;
import edu.duke.cabig.c3pr.dao.ParticipantDao;
import edu.duke.cabig.c3pr.domain.HealthcareSite;
import edu.duke.cabig.c3pr.domain.Participant;
import edu.duke.cabig.c3pr.utils.ContextTools;
import edu.duke.cabig.c3pr.web.EditParticipantController.LOV;
import static org.easymock.classextension.EasyMock.expect;

/**
 * @author Ramakrishna
 */

public class EditParticipantControllerTest extends ControllerTestCase {

	private EditParticipantController controller = new EditParticipantController();

	private ParticipantDaoMock participantDao;

	private HealthCareSiteDaoMock healthcareSiteDao;

	private ApplicationContext context;

	protected void setUp() throws Exception {
		super.setUp();
		context = ContextTools.createDeployedApplicationContext();
		participantDao = registerMockFor(ParticipantDaoMock.class);
		controller.setParticipantDao(participantDao);
		healthcareSiteDao = registerMockFor(HealthCareSiteDaoMock.class);
		controller.setHealthcareSiteDao(healthcareSiteDao);
	}

	public void testReferenceData() throws Exception {
		Map<String, Object> refdata = controller.referenceData(request, 2);
		List<LOV> races = (List<LOV>) refdata.get("raceCode");
		Iterator<LOV> genderIter = races.iterator();
		LOV race;
		while (genderIter.hasNext()) {
			race = genderIter.next();
			if (race.getCode() == "White") {
				assertEquals("RaceCodes missing or wrong", "White", race
						.getDesc());

			}
		}
	}

	public class HealthCareSiteDaoMock extends HealthcareSiteDao {

		public List<HealthcareSite> getAll() {
			List list = new ArrayList();
			return list;
		}
	}

	public class ParticipantDaoMock extends ParticipantDao {

		public Participant getById(int id, boolean bool) {
			Participant participant = new Participant();
			return participant;
		}
	}
}
{'fraction_non_alphanumeric': 0.09879725085910653, 'fraction_numerical': 0.003436426116838488, 'mean_word_length': 5.770348837209302, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5632474', 'n_tokens_mistral': 773, 'n_tokens_neox': 722, 'n_words': 138}