package kr.co.zumo.app.lifeplus.bean.api;

import org.junit.Test;

import static org.junit.Assert.*;

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

  @Test
  public void isChecked() {
    PolicyBean bean = new PolicyBean(1, 1);

    assertEquals(false, bean.isChecked());

    bean.setChecked(true);
    assertEquals(true, bean.isChecked());
    assertEquals(false, bean.isMandatory());
    assertEquals(null, bean.getTitle());
    assertEquals(null, bean.getUrl());
  }

  @Test
  public void isMandatory() {
    PolicyBean bean = new PolicyBean(1, 1);

    assertEquals(false, bean.isMandatory());

    bean.setMandatory(true);
    assertEquals(false, bean.isChecked());
    assertEquals(true, bean.isMandatory());
    assertEquals(null, bean.getTitle());
    assertEquals(null, bean.getUrl());
  }

  @Test
  public void setTitle() {
    PolicyBean bean = new PolicyBean(1, 1);

    assertEquals(null, bean.getTitle());

    bean.setTitle("title");
    assertEquals(false, bean.isChecked());
    assertEquals(false, bean.isMandatory());
    assertEquals("title", bean.getTitle());
    assertEquals(null, bean.getUrl());
  }

  @Test
  public void setUrl() {
    PolicyBean bean = new PolicyBean(1, 1);

    assertEquals(null, bean.getUrl());

    bean.setUrl("url");
    assertEquals(false, bean.isChecked());
    assertEquals(false, bean.isMandatory());
    assertEquals(null, bean.getTitle());
    assertEquals("url", bean.getUrl());
  }
}