Package testes.unidade

Source Code of testes.unidade.EmpresaControllerTest

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

package testes.unidade;

import controllerTeste.EmpresaController;
import junit.framework.TestCase;
import model.Empresa;

/**
*
* @author RONALDO
*/
public class EmpresaControllerTest extends TestCase {
   
    public EmpresaControllerTest(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 EmpresaController.
     */
    public void testGetNovoCodigo() {
        System.out.println("EmpresaControllerTest - getNovoCodigo");
        EmpresaController instance = new EmpresaController();
        String expResult = "1";
        String result = instance.getNovoCodigo();
        assertEquals(expResult, result);
    }

    /**
     * Test of getEmpresa method, of class EmpresaController.
     */
    public void testGetEmpresa() {
        System.out.println("EmpresaControllerTest - getEmpresa");
        String codigo = "1";
        EmpresaController instance = new EmpresaController();
        int expResult = 1;
        int result = instance.getEmpresa(codigo).getCodigoEmpresa();
        assertEquals(expResult, result);
    }

    /**
     * Test of atualizar method, of class EmpresaController.
     */
    public void testAtualizar() {
        System.out.println("EmpresaControllerTest - atualizar");
        String codigo = "1";
        Empresa pEmpresa = new Empresa();
        pEmpresa.setCodigoEmpresa(Integer.parseInt(codigo));
        pEmpresa.setCodigoPessoa(Integer.parseInt(codigo));
        EmpresaController instance = new EmpresaController();
        boolean expResult = true;
        boolean result = instance.atualizar(pEmpresa);
        assertEquals(expResult, result);
    }

    /**
     * Test of salvar method, of class EmpresaController.
     */
    public void testSalvar() {
        System.out.println("EmpresaControllerTest - salvar");
        String codigo = "1";
        Empresa pEmpresa = new Empresa();
        pEmpresa.setCodigoEmpresa(Integer.parseInt(codigo));
        pEmpresa.setCodigoPessoa(Integer.parseInt(codigo));
        EmpresaController instance = new EmpresaController();
        boolean expResult = true;
        boolean result = instance.salvar(pEmpresa);
        assertEquals(expResult, result);
    }

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

}
TOP

Related Classes of testes.unidade.EmpresaControllerTest

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.