package org.jerrymouse.chineseCalendar.service.impl;

import java.util.List;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jerrymouse.chineseCalendar.model.birthday.Birthday;
import org.jerrymouse.chineseCalendar.model.birthday.Period;
import org.jerrymouse.chineseCalendar.model.birthday.PeriodUpdater;
import org.jerrymouse.chineseCalendar.service.BirthdayService;
import org.jerrymouse.chineseCalendar.test.TestDataProvier;
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 BirthdayServiceImplTest {
	@Autowired
	BirthdayService birthdayService;
	Log logger = LogFactory.getLog(BirthdayServiceImplTest.class);

	@Autowired
	PeriodUpdater periodUpdater;

	@Autowired
	TestDataProvier testDataProvier;

	@Before
	public void setUp() throws Exception {
	}

	@Test
	public void testCalculateAll() throws Exception {
		List<Birthday> birthdays = testDataProvier.generateTestData();
		List<Birthday> birthdaysList = birthdayService.calculate(birthdays,
				new Period("2000-1-1", "2010-1-1"));
		logger.debug(birthdaysList);
	}

	@Test
	public void testCalculateOne() {
		Birthday birthday = new Birthday("颜开-1989-1-28");
		List<Birthday> birthdays = birthdayService.calculate(birthday,
				new Period("2000-1-1", "2010-1-1"));
		logger.debug(birthdays);
	}

	@Test
	public void testDecode() {
	}

}
