/**
 * 
 */
package routines;

import static org.junit.jupiter.api.Assertions.assertEquals;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;

import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

/**
 * @author u401455
 *
 */
class ValidityCheckTest {
	private static final LcagLogger log = LcagLogger.getLogger(LcagDateTimeTest.class);
	private static SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("dd-MM-yyyy");
	private static ArrayList<Date> orderedDates = new ArrayList<Date>();

	@BeforeAll
	static void setUpBeforeClass() throws Exception {
		Date d = null;

		orderedDates.add(DATE_FORMAT.parse("01-01-2000"));
		orderedDates.add(DATE_FORMAT.parse("01-01-2022"));
		orderedDates.add(DATE_FORMAT.parse("02-01-2022"));
		orderedDates.add(DATE_FORMAT.parse("04-04-2040"));
		orderedDates.add(DATE_FORMAT.parse("05-04-2040"));
		orderedDates.add(DATE_FORMAT.parse("06-06-2066"));
	}

	/**
	 * @throws java.lang.Exception
	 */
	@AfterAll
	static void tearDownAfterClass() throws Exception {
	}

	/**
	 * @throws java.lang.Exception
	 */
	@BeforeEach
	void setUp() throws Exception {
	}

	/**
	 * @throws java.lang.Exception
	 */
	@AfterEach
	void tearDown() throws Exception {
	}

	/**
	 * Test method for
	 * {@link routines.ValidityCheck#timelineValidity(java.util.Date, java.util.Date, java.util.Date, java.util.Date)}.
	 * 
	 * @throws ParseException
	 */
	@Test
	void testTimelineValidity() throws ParseException {
		String result;
		// ValidityCheck.timelineValidity(existing_validFrom, existing_validTo,
		// new_validFrom, new_validTo)
		result = ValidityCheck.timelineValidity(DATE_FORMAT.parse("01-01-2020"), DATE_FORMAT.parse("05-04-2040"),
				DATE_FORMAT.parse("06-04-2040"), DATE_FORMAT.parse("05-05-2055")).name();

		assertEquals(ValidityCheck.CheckResult.EXTENDS_AFTER.toString(), result, "Tc1 Adjactent periods should be OK");
	}

}
