package org.treesched;

import junit.framework.TestCase;

/**
 * 
 */
public class IntervalTest extends TestCase {

	public IntervalTest(String arg0) {
		super(arg0);
	}

	/*
	 * Test for boolean equals(BetweenTimes)
	 */
	final public void testEquals() {

		Interval test = new Interval(
				DateUtilsTest.parseTime("11-jul-03 12:15"), 
				DateUtilsTest.parseTime("12-jul-03 23:17"));

		Interval copy = new Interval(test);
		
		assertTrue(test.equals(copy));
	}

	/*
	 * Test for boolean isBefore(BetweenTimes)
	 */
	final public void testIsBeforeBetweenTimes() {

		Interval test1 = new Interval(
		        DateUtilsTest.parseTime("11-jul-03 12:15"), 
		        DateUtilsTest.parseTime("12-jul-03 23:17"));

		Interval test2 = new Interval(
		        DateUtilsTest.parseTime("12-jul-03 12:15"), 
		        DateUtilsTest.parseTime("13-jul-03 23:17"));
				
		assertTrue(test1.isBefore(test2));
	}

	/*
	 * Test for boolean isPast(BetweenTimes)
	 */
	final public void testIsPastBetweenTimes() {

		Interval test1 = new Interval(
				DateUtilsTest.parseTime("11-jul-03 12:15"), 
				DateUtilsTest.parseTime("12-jul-03 23:17"));

		Interval test2 = new Interval(
		        DateUtilsTest.parseTime("13-jul-03 12:15"), 
		        DateUtilsTest.parseTime("13-jul-03 23:17"));
				
		assertTrue(test2.isPast(test1));
	}

}
