@Test
	public void testRetrieveUserByName() {
		em.getTransaction().begin();
		em.createNativeQuery("INSERT INTO t_users( user_id, name, date_added, description)"
				+ " VALUES (1, 'BOOM1', '1988-09-15', 'TEST USER1');").executeUpdate();
		em.createNativeQuery("INSERT INTO t_users( user_id, name, date_added, description)"
				+ " VALUES (2, 'BOOM2', '1988-09-15', 'TEST USER2');").executeUpdate();
		em.createNativeQuery("INSERT INTO t_users( user_id, name, date_added, description)"
				+ " VALUES (3, 'BOOM3', '1988-09-15', 'TEST USER3');").executeUpdate();
		em.getTransaction().commit();
		List<User> users = null;
		try {
			//TODO use .equals() once we ahve overridden appropriate methods
			users = dao.getUsers();
		} catch (Throwable th){
			fail(th.getMessage());
		}
		Calendar cal = Calendar.getInstance();
		cal.set(1988, Calendar.SEPTEMBER, 15, 0, 0, 0);
		assertEquals(3, users.size());
		for (int i = 0; i < 3; i++) {
			assertEquals("BOOM" + users.get(i).getId(), users.get(i).getName());
			assertEquals("TEST USER" + users.get(i).getId(), users.get(i).getDescription());
			assertEquals(cal.getTime().toString(), users.get(i).getDate().toString());
		}
	}
@Test
	public void testRetrieveUserByName() {
		em.getTransaction().begin();
		em.createNativeQuery("INSERT INTO t_users( user_id, name, date_added, description)"
				+ " VALUES (1, 'BOOM1', '1988-09-15', 'TEST USER1');").executeUpdate();
		em.createNativeQuery("INSERT INTO t_users( user_id, name, date_added, description)"
				+ " VALUES (2, 'BOOM2', '1988-09-15', 'TEST USER2');").executeUpdate();
		em.createNativeQuery("INSERT INTO t_users( user_id, name, date_added, description)"
				+ " VALUES (3, 'BOOM3', '1988-09-15', 'TEST USER3');").executeUpdate();
		em.getTransaction().commit();
		List<User> users = null;
		try {
		
			users = dao.getUsers();
		} catch (Throwable th){
			fail(th.getMessage());
		}
		Calendar cal = Calendar.getInstance();
		cal.set(1988, Calendar.SEPTEMBER, 15, 0, 0, 0);
		assertEquals(3, users.size());
		for (int i = 0; i < 3; i++) {
			assertEquals("BOOM" + users.get(i).getId(), users.get(i).getName());
			assertEquals("TEST USER" + users.get(i).getId(), users.get(i).getDescription());
			assertEquals(cal.getTime().toString(), users.get(i).getDate().toString());
		}
	}
@test public void testretrieveuserbyname() { em.gettransaction().begin(); em.createnativequery("insert into t_users( user_id, name, date_added, description)" + " values (1, 'boom1', '1988-09-15', 'test user1');").executeupdate(); em.createnativequery("insert into t_users( user_id, name, date_added, description)" + " values (2, 'boom2', '1988-09-15', 'test user2');").executeupdate(); em.createnativequery("insert into t_users( user_id, name, date_added, description)" + " values (3, 'boom3', '1988-09-15', 'test user3');").executeupdate(); em.gettransaction().commit(); list<user> users = null; try { users = dao.getusers(); } catch (throwable th){ fail(th.getmessage()); } calendar cal = calendar.getinstance(); cal.set(1988, calendar.september, 15, 0, 0, 0); assertequals(3, users.size()); for (int i = 0; i < 3; i++) { assertequals("boom" + users.get(i).getid(), users.get(i).getname()); assertequals("test user" + users.get(i).getid(), users.get(i).getdescription()); assertequals(cal.gettime().tostring(), users.get(i).getdate().tostring()); } }