<commit_before>package org.ccci.gto.android.common.db;

import android.text.TextUtils;
import android.util.Pair;

import org.ccci.gto.android.common.db.Contract.RootTable;
import org.ccci.gto.android.common.testing.CommonMocks;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;

import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.nullValue;
import static org.hamcrest.core.AnyOf.anyOf;
import static org.junit.Assert.assertThat;

@RunWith(PowerMockRunner.class)
@PrepareForTest({Pair.class, TextUtils.class})
public class QueryTest {
    private TestDao getDao() {
        return TestDao.mock();
    }

    @Before
    public void setup() throws Exception {
        CommonMocks.mockPair();
        CommonMocks.mockTextUtils();
    }

    @Test
    public void testHavingSql() {
        Expression having = RootTable.FIELD_TEST.count().eq(1);
        Query query = Query.select(RootTable.class).groupBy(RootTable.FIELD_TEST).having(having);
        Pair<String, String[]> sqlPair = query.buildSqlHaving(getDao());
        assertThat(sqlPair.first, is("(COUNT (root.test) == 1)"));
    }

    @Test
    public void verifyLimitSql() {
        final Query<RootTable> query = Query.select(RootTable.class);
        assertThat(query.limit(null).buildSqlLimit(), nullValue());
        assertThat(query.limit(null).offset(10).buildSqlLimit(), nullValue());
        assertThat(query.limit(5).offset(null).buildSqlLimit(), is("5"));
        assertThat(query.limit(5).offset(15).buildSqlLimit(), anyOf(is("5 OFFSET 15"), is("15,5")));
    }
}<commit_msg>add generic to fix lint warning<commit_after>package org.ccci.gto.android.common.db;

import android.text.TextUtils;
import android.util.Pair;

import org.ccci.gto.android.common.db.Contract.RootTable;
import org.ccci.gto.android.common.testing.CommonMocks;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;

import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.nullValue;
import static org.hamcrest.core.AnyOf.anyOf;
import static org.junit.Assert.assertThat;

@RunWith(PowerMockRunner.class)
@PrepareForTest({Pair.class, TextUtils.class})
public class QueryTest {
    private TestDao getDao() {
        return TestDao.mock();
    }

    @Before
    public void setup() throws Exception {
        CommonMocks.mockPair();
        CommonMocks.mockTextUtils();
    }

    @Test
    public void testHavingSql() {
        Expression having = RootTable.FIELD_TEST.count().eq(1);
        Query<RootTable> query = Query.select(RootTable.class).groupBy(RootTable.FIELD_TEST).having(having);
        Pair<String, String[]> sqlPair = query.buildSqlHaving(getDao());
        assertThat(sqlPair.first, is("(COUNT (root.test) == 1)"));
    }

    @Test
    public void verifyLimitSql() {
        final Query<RootTable> query = Query.select(RootTable.class);
        assertThat(query.limit(null).buildSqlLimit(), nullValue());
        assertThat(query.limit(null).offset(10).buildSqlLimit(), nullValue());
        assertThat(query.limit(5).offset(null).buildSqlLimit(), is("5"));
        assertThat(query.limit(5).offset(15).buildSqlLimit(), anyOf(is("5 OFFSET 15"), is("15,5")));
    }
}
{'fraction_non_alphanumeric': 0.1384659580580293, 'fraction_numerical': 0.009192760700948004, 'mean_word_length': 4.228228228228228, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7489685', 'n_tokens_mistral': 1105, 'n_tokens_neox': 1095, 'n_words': 181}