@Override protected SearchStoredQueries createQuery() throws Exception { SearchStoredQueries q = new SearchStoredQueries(); q.setValue("test"); Assert.assertEquals( "select idquery,count(idstructure) as rows,name,content from query_results join query using(idquery) join sessions using (idsessions) where user_name=SUBSTRING_INDEX(user(),'@',1) and name regexp ? group by idquery order by idquery desc", q.getSQL()); Assert.assertEquals("^test", q.getValue()); return q; }
@Override protected void verify(SearchStoredQueries query, ResultSet rs) throws Exception { int count = 0; while (rs.next()) { IStoredQuery q = query.getObject(rs); Assert.assertTrue( ((q.getId() == 1) && (q.getName().equals("test query 1"))) || ((q.getId() == 2) && (q.getName().equals("test query 2")))); count++; } Assert.assertEquals(2, count); }