I want to compare two Integer lists in junit for unit test. But it show error. Here is the Question class, GetAllRejectId() method
public List<Integer> GetAllRejectId() {
Session session = null;
List<Integer> list = null;
int id = 0;
Question qOut = new Question();
try {
SessionFactory sessionFactory = new Configuration().configure()
.buildSessionFactory();
session = sessionFactory.openSession();
String SQL_QUERY = "from Question as q where q.approveStatus='2'";
Query query = session.createQuery(SQL_QUERY);
// Criteria criteria=session.createCriteria(Question.class);
list = query.list();
/*
* for (Iterator it = list.iterator(); it.hasNext();) { Question
* p=(Question) it.next();
*
* System.out.print(p.getId());
* }
*/
}
catch (Exception e) {
System.out.println(e);
} finally {
session.flush();
session.close();
}
return list;
}
this is my test class method.
public void testGetAllRejectId(){
QuestionBLO objBLO=new QuestionBLO();
List<Integer> mylistActual = objBLO.GetAllRejectId();
Integer[] expectedQuestionsArray={1};
List<Integer> actualQuestionList = Arrays.asList(expectedQuestionsArray);
/* Here I need some kind of mechanism to compare mylistActual agains actualQuestionList . */
Can some one help me. Thanks in advance.