package edu.uoc.prezmm.a1list2cook.objects_class;

import org.junit.Before;
import org.junit.Test;

import static org.junit.Assert.*;
import static org.mockito.Mockito.mock;

public class UsersTest {

    private Users object;

    private String code;
    private String name;
    private String mail;

    @Before
    public void setUp() {
        object = mock(Users.class);

        code = "1";
        name = "User 01";
        mail = "user01@1list2cook.com";

        object = new Users(code,name,mail);
    }

    @Test
    //Comprova que s'obte el valor esperat
    public void getUserCode() {
        assertEquals(code,object.getUserCode());
    }

    @Test
    //Comprova que es pot modificar correctament el valor i retorna un String
    public void setUserCode() {
        String newValue = "2";
        object.setUserCode(newValue);
        assertEquals(newValue,object.getUserCode());
    }

    @Test
    //Comprova que s'obte el valor esperat
    public void getUserName() {
        assertEquals(name,object.getUserName());
    }

    @Test
    //Comprova que es pot modificar correctament el valor i retorna un String
    public void setUserName() {
        String newValue = "User 02";
        object.setUserName(newValue);
        assertEquals(newValue,object.getUserName());
    }

    @Test
    //Comprova que s'obte el valor esperat
    public void getUserMail() {
        assertEquals(mail,object.getUserMail());
    }

    @Test
    //Comprova que es pot modificar correctament el valor i retorna un String
    public void setUserMail() {
        String newValue = "user02@1list2cook.com";
        object.setUserMail(newValue);
        assertEquals(newValue,object.getUserMail());
    }
}