Tomcatを使用してWebページにEXT JSフォームを入力するために、EXT JSと休止状態でSpringを使用しています...データベースにアクセスしてHQLステートメントを返すメソッドを使用してテーブルにデータを入力しています
今、返されたレコードの数をカウントするために単純な JUnit テストを実行しようとしていますが、EXT JS フォームに入力する JUint テストでメソッドを呼び出すと、この例外が返されます...理由はわかりません
JUnit テスト クラス
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);
}
}
データベースにアクセスする私の方法
public List<Customer> findAllCustomers(){
List<Customer> list = getHibernateTemplate().find("from Customer");
return list;
}
そして、データベースにアクセスするメソッドを呼び出す私のメソッド
public List<Customer> returnAllCustomers(){
List<Customer> list = customerDaoImpl.findAllCustomers();
return list;
}
ここで、junit(findAllCustomers()) と同じメソッドを使用して、フォームにデータベースのアイテムが取り込まれていることがわかります。
誰にもアイデアはありますか?