I am using Spring with EXT JS and hibernate to populate a EXT JS form on a webpage using tomcat... I have the table populating using a method that accesses the database and returns my HQL statement
Now i am trying to execute a simple JUnit test to count the number of records returned but when i am calling the method in the JUint test that populates the EXT JS form, it returns this excception... I dont know why
JUnit Test class
package com.fexco.helloworld.web;
import static org.junit.Assert.assertEquals;
import java.util.List;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import com.fexco.helloworld.web.dao.CustomerDaoImpl;
import com.fexco.helloworld.web.model.Customer;
/**
* Unit test for simple App.
* /
public class CustomerServiceTest {
@Autowired
private CustomerDaoImpl customerDaoImpl;
@Test
public void findAllCustomersTest() {
List<Customer> list = customerDaoImpl.findAllCustomers();
int numberInDatabase = list.size();
assertEquals(5, numberInDatabase);
}
}
my method accessing the database
public List<Customer> findAllCustomers(){
List<Customer> list = getHibernateTemplate().find("from Customer");
return list;
}
and my method calling the method accessing the database
public List<Customer> returnAllCustomers(){
List<Customer> list = customerDaoImpl.findAllCustomers();
return list;
}
you can see here that the form is populated with items from the database using the same method as in junit(findAllCustomers())
Does anybody have any ideas?