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 CategoriesTest {

    private Categories object;
    private String cateCode;
    private String cateName;

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

        cateCode = "1";
        cateName = "Categoria 1";

        object = new Categories(cateCode,cateName);
    }

    @Test
    //Comprova que s'obte el valor esperat
    public void getCode() {
        String codeGet = String.valueOf(object.getCode());
        assertEquals(cateCode,codeGet);
    }

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

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

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