Package testes.unidade

Source Code of testes.unidade.CandidatoControllerTest

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/

package testes.unidade;

import controllerTeste.CandidatoController;
import junit.framework.TestCase;
import model.Candidato;

/**
*
* @author Sheila
*/
public class CandidatoControllerTest extends TestCase {
   
    public CandidatoControllerTest(String testName) {
        super(testName);
    }           

    @Override
    protected void setUp() throws Exception {
        super.setUp();
    }

    @Override
    protected void tearDown() throws Exception {
        super.tearDown();
    }

    /**
     * Test of getNovoCodigo method, of class CandidatoController.
     */
    public void testGetNovoCodigo() {
        System.out.println("CandidatoControllerTest - getNovoCodigo");
        CandidatoController instance = new CandidatoController();
        String expResult = "1";
        String result = instance.getNovoCodigo();
        assertEquals(expResult, result);
    }

    /**
     * Test of getCandidato method, of class CandidatoController.
     */
    public void testGetCandidato() {
        System.out.println("CandidatoControllerTest - getCandidato");
        String codigo = "1";
        CandidatoController instance = new CandidatoController();
        int expResult = 1;
        int result = instance.getCandidato(codigo).getCodigoCandidato();
        assertEquals(expResult, result);
    }

    /**
     * Test of getCandidatoSemFiltro method, of class CandidatoController.
     */
    public void testGetCandidatoSemFiltro() {
        System.out.println("CandidatoControllerTest - getCandidatoSemFiltro");
        String codigo = "2";
        CandidatoController instance = new CandidatoController();
        int expResult = 2;
        int result = instance.getCandidatoSemFiltro(codigo).getCodigoCandidato();
        assertEquals(expResult, result);
    }

    /**
     * Test of atualizar method, of class CandidatoController.
     */
    public void testAtualizar() {
        System.out.println("CandidatoControllerTest - atualizar");
        String codigo = "1";
        Candidato pCandidato = new Candidato();
        pCandidato.setCodigoCandidato(Integer.parseInt(codigo));
        CandidatoController instance = new CandidatoController();
        boolean expResult = true;
        boolean result = instance.atualizar(pCandidato);
        assertEquals(expResult, result);
    }

    /**
     * Test of salvar method, of class CandidatoController.
     */
    public void testSalvar() {
        System.out.println("CandidatoControllerTest - salvar");
        String codigo = "1";
        Candidato pCandidato = new Candidato();
        pCandidato.setCodigoCandidato(Integer.parseInt(codigo));
        CandidatoController instance = new CandidatoController();
        boolean expResult = true;
        boolean result = instance.salvar(pCandidato);
        assertEquals(expResult, result);
    }

    /**
     * Test of excluir method, of class CandidatoController.
     */
    public void testExcluir() {
        System.out.println("CandidatoControllerTest - excluir");
        String codigo = "1";
        CandidatoController instance = new CandidatoController();
        boolean expResult = true;
        boolean result = instance.excluir(codigo);
        assertEquals(expResult, result);
    }

    /**
     * Test of aprovarCandidato method, of class CandidatoController.
     */
    public void testAprovarCandidato() {
        System.out.println("CandidatoControllerTest - aprovarCandidato");
        String codigo = "1";
        CandidatoController instance = new CandidatoController();
        boolean expResult = true;
        boolean result = instance.aprovarCandidato(codigo);
        assertEquals(expResult, result);
    }
}
TOP

Related Classes of testes.unidade.CandidatoControllerTest

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.