package kr.co.zumo.app.lifeplus.util;

import org.junit.Test;

import java.util.Calendar;

import static junit.framework.Assert.assertFalse;
import static junit.framework.Assert.assertTrue;

/**
 * DateUtilTest
 * <pre>
 * </pre>
 *
 * @author 민효동
 * @version 1.0
 * @history 민효동   [2018. 9. 18.]   [최초 작성]
 * @since 2018. 9. 18.
 */
public class DateUtilTest {

  @Test
  public void minAge() {

    Calendar birthday;
    long birthdayMillis;

    birthday = Calendar.getInstance();
    birthday.set(2004, Calendar.SEPTEMBER, 18);
    birthdayMillis = birthday.getTimeInMillis();

    assertTrue(DateUtil.minAge(14, birthdayMillis));

    birthday = Calendar.getInstance();
    birthday.set(1979, Calendar.JANUARY, 8);
    birthdayMillis = birthday.getTimeInMillis();

    assertTrue(DateUtil.minAge(14, birthdayMillis));

    birthday = Calendar.getInstance();
    birthday.set(2005, Calendar.APRIL, 22);
    birthdayMillis = birthday.getTimeInMillis();

    assertFalse(DateUtil.minAge(14, birthdayMillis));
    birthday = Calendar.getInstance();
    birthday.set(2105, Calendar.APRIL, 22);
    birthdayMillis = birthday.getTimeInMillis();

    assertFalse(DateUtil.minAge(14, birthdayMillis));

  }
}