package edu.upc.caminstech.equipstic;

import static org.junit.Assert.*;

import org.junit.Before;
import org.junit.Test;
import org.springframework.util.StringUtils;

public class TipusInfraestructuraTests {

    private TipusInfraestructura tipus;
    private TipusInfraestructura copia;
    private Categoria cat;

    @Before
    public void setUp() throws Exception {
        cat = new Categoria(1, "CAT1", "C1");
        tipus = new TipusInfraestructura(1, "TIPUS 1", "T1", true, cat);
        copia = new TipusInfraestructura(1, "TIPUS 1", "T1", true, cat);
    }

    @Test
    public void testTipusInfraestructura() {
        assertNotNull(tipus);
    }

    @Test
    public void testGetCategoriaInfraestructura() {
        assertEquals(cat, tipus.getCategoriaInfraestructura());
    }

    @Test
    public void testGetIdTipus() {
        assertEquals(1, tipus.getIdTipus());
    }

    @Test
    public void testGetNom() {
        assertEquals("TIPUS 1", tipus.getNom());
    }

    @Test
    public void testGetCodi() {
        assertEquals("T1", tipus.getCodi());
    }

    @Test
    public void testIsRequereixCampsExtra() {
        assertTrue(tipus.isRequereixCampsExtra());
    }

    @Test
    public void testToString() {
        assertTrue(StringUtils.substringMatch(tipus.toString(), 0, "[TipusInfraestructura "));
    }

    @Test
    public void testEquals() {
        assertEquals(tipus, copia);
    }

    @Test
    public void testEqualsFalse() {
        TipusInfraestructura tipus2 = new TipusInfraestructura(2, "TIPUS 2", "T2", true, cat);
        assertNotEquals(tipus, tipus2);
    }

    @Test
    public void testHashCode() {
        assertEquals(tipus.hashCode(), copia.hashCode());
    }

}

@@ -67,146 +67,697 @@
 ert.
-*;%0A%0Aimport org.junit.Before;%0Aimport org.junit.Test;%0Aimport org.springframework.util.StringUtils;%0A%0Apublic class TipusInfraestructuraTests %7B
+assertEquals;%0Aimport static org.junit.Assert.assertFalse;%0Aimport static org.junit.Assert.assertNotEquals;%0Aimport static org.junit.Assert.assertNotNull;%0Aimport static org.junit.Assert.assertTrue;%0A%0Aimport org.junit.Before;%0Aimport org.junit.Test;%0Aimport org.springframework.util.StringUtils;%0A%0Apublic class TipusInfraestructuraTests %7B%0A%0A    private static final TipusInfraestructura PORTATIL = new TipusInfraestructura(0, %22Portatil%22, %22PORTATIL%22, true,%0A            new Categoria(0, %22Equip treball%22, %22EQUIP_TREBALL%22));%0A%0A    private static final TipusInfraestructura MONITOR = new TipusInfraestructura(0, %22Monitor%22, %22MONITOR%22, true,%0A            new Categoria(0, %22Equip treball%22, %22EQUIP_TREBALL%22));
 %0A%0A  
@@ -834,16 +834,17 @@
  copia;%0A
+%0A
     priv
@@ -2269,10 +2269,225 @@
 %0A    %7D%0A%0A
+    @Test%0A    public void testCalModelCpuForPortatil() %7B%0A        assertTrue(PORTATIL.calModelCpu());%0A    %7D%0A%0A    @Test%0A    public void testCalModelCpuForMonitor() %7B%0A        assertFalse(MONITOR.calModelCpu());%0A    %7D%0A%0A
 %7D%0A

Add test for new methods