Package co.nubetech.crux.dao

Source Code of co.nubetech.crux.dao.TestFunctionDAO

package co.nubetech.crux.dao;

import static org.junit.Assert.assertEquals;

import java.sql.Statement;

import org.junit.Test;

import co.nubetech.crux.model.Function;

public class TestFunctionDAO extends DBConnection {

  @Test
  public void testFindById() throws Exception {
    FunctionDAO functionDAO = new FunctionDAO();
    functionDAO.session = com.googlecode.s2hibernate.struts2.plugin.util.HibernateSessionFactory
        .getNewSession();
    ValueTypeDAO valueTypeDAO = new ValueTypeDAO();
    valueTypeDAO.session = functionDAO.session;
    Statement stmt = getStatement();
    stmt.executeUpdate("insert into function values(99999,'sum','class.Sum',false,1,1)");
    Function function = new Function(99999,"sum","class.Sum",false,valueTypeDAO.findById(1l), valueTypeDAO.findById(1l));
    assertEquals(function, functionDAO.findById(99999l));
    functionDAO.session.close();
    stmt.executeUpdate("delete from function where id=99999");
    stmt.close();
  }
}
TOP

Related Classes of co.nubetech.crux.dao.TestFunctionDAO

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.