Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

comparing two Integer lists

807591May 29 2008 — edited May 29 2008
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.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 26 2008
Added on May 29 2008
24 comments
1,135 views