package org.jerrymouse.chineseCalendar.model;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jerrymouse.chineseCalendar.model.birthday.BirthdayEncoder;
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 BirthdayEncoderTest {
	@Autowired
	BirthdayEncoder birthdayEncoder;
	Log logger = LogFactory.getLog(getClass());

	@Autowired
	TestDataProvier testDataProvier;

	@Before
	public void setUp() throws Exception {
	}

	@Test
	public void testDecode() {
		String code = "%E9%A2%9C%E5%BC%80-1989-1-28%2C%E9%A2%9C%E6%BE%8D-1989-5-7%2C";
		logger.debug(code);
		logger.debug(birthdayEncoder.decode(code));
	}

	@Test
	public void testEncode() {
		logger.debug(testDataProvier.generateTestData());
		logger
				.debug(birthdayEncoder.encode(testDataProvier
						.generateTestData()));
	}

}
