public void testLimitFavourites() {
UserIdentifier userId = new UserIdentifier(UUID.randomUUID());
QueryFavourites history = new QueryFavourites();
{
for (int i = 0; i < 50; i++) {
CqlQuery query = new CqlQuery(CqlQueryType.SELECT, "select * from MyTable where id=" + i);
assertTrue(history.addWithSizeCheck(new QueryEntry(query, 234)));
}
assertEquals(50, history.size());
}
checkFavLimitContent(history);
{
for (int i = 0; i < 10; i++) {
CqlQuery query = new CqlQuery(CqlQueryType.SELECT, "select * from MyTableA where id=" + i);
assertFalse(history.addWithSizeCheck(new QueryEntry(query, 456)));
}
checkFavLimitContent(history);
}
{
for (int i = 0; i < 20; i++) {
CqlQuery query = new CqlQuery(CqlQueryType.SELECT, "select * from MyTable where id=" + i);
assertTrue(history.addWithSizeCheck(new QueryEntry(query, 234)));
}
checkFavLimitContent(history);
}