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

import org.junit.Test;

import static org.junit.Assert.assertEquals;

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

  @Test
  public void setReturnMessage() {
    LifeplusAPIBean bean = new LifeplusAPIBean();
    bean.setReturnMessage("success");

    assertEquals("success", bean.getReturnMessage());
    assertEquals(LifeplusAPIBean.RETURN_DEFAULT, bean.getCode());
  }

  @Test
  public void setCode() {
    LifeplusAPIBean bean = new LifeplusAPIBean();
    bean.setCode(1);

    assertEquals(null, bean.getReturnMessage());
    assertEquals(1, bean.getCode());
  }

  @Test
  public void isSuccess() {
    LifeplusAPIBean bean = new LifeplusAPIBean();
    assertEquals(false, bean.isSuccess());

    bean.setCode(LifeplusAPIBean.RETURN_SUCCESS);
    assertEquals(true, bean.isSuccess());

    bean.setCode(LifeplusAPIBean.RETURN_PARAMETER_ERROR);
    assertEquals(false, bean.isSuccess());
  }
}