package org.jerrymouse.chineseCalendar.model;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jerrymouse.chineseCalendar.model.birthday.Period;
import org.jerrymouse.chineseCalendar.model.birthday.PeriodUpdater;
import org.jerrymouse.chineseCalendar.test.TestInfo;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = { TestInfo.ApplicationContentPath })
public class PeriodUpdaterTest {
	Log logger = LogFactory.getLog(PeriodUpdaterTest.class);

	@Autowired
	PeriodUpdater periodUpdater;

	@Before
	public void setUp() throws Exception {
	}

	@Test
	public void testGetNextWeek() throws Exception {
		Period period = periodUpdater.getNextWeek();
		logger.trace(period.begin);
		logger.trace(period.end);
	}

	@Test
	public void testGetThisMonth() throws Exception {
		Period period = periodUpdater.getThisMonth();
		logger.trace(period.begin);
		logger.trace(period.end);
	}

	@Test
	public void testGetThisWeek() throws Exception {
		Period period = periodUpdater.getThisWeek();
		logger.trace(period.begin);
		logger.trace(period.end);
	}

	@Test
	public void testGetThisYear() throws Exception {
		Period period = periodUpdater.getThisYear();
		logger.trace(period.begin);
		logger.trace(period.end);
	}

}
