package edu.duke.cabig.c3pr.domain;

import java.text.ParseException;
import java.util.Calendar;

import edu.duke.cabig.c3pr.AbstractTestCase;
import edu.duke.cabig.c3pr.utils.DateUtil;
import edu.duke.cabig.c3pr.utils.StudyCreationHelper;

public class StudyAmendmentTestCase extends AbstractTestCase {
	
	private Study amendedStudy ;
	private StudyCreationHelper studyCreationHelper = new StudyCreationHelper();
	public void setStudyCreationHelper(StudyCreationHelper studyCreationHelper) {
		this.studyCreationHelper = studyCreationHelper;
	}

	@Override
	protected void setUp() throws Exception {
		super.setUp();
		amendedStudy = studyCreationHelper.buildStudyWithAmendment();
	}
	
	public void testGetAmendmentDateStr(){
		try {
			assertEquals("Amendment date should be current date",  DateUtil.formatDate(Calendar.getInstance().getTime(), "MM/dd/yyyy"), amendedStudy.getCurrentStudyAmendment().getAmendmentDateStr());
		} catch (ParseException e) {
			e.printStackTrace();
		}
	}

}

@@ -980,12 +980,323 @@
 ;%0A%09%09%7D%0A%09%7D
+%0A%09%0A%09public void testGetAmendmentDateStrThrowsException()%7B%0A%09%09Study amendedStudyWithNoAmendmentDate =studyCreationHelper.buildStudyWithAmendmentWithNoAmendmentDate();%0A%09%09assertEquals(%22Amendment date should be current date%22,  %22%22, amendedStudyWithNoAmendmentDate.getCurrentStudyAmendment().getAmendmentDateStr());%0A%09%7D
 %0A%0A%7D%0A

test case coverage improvement