<commit_before>/*
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.jdbi.v3.sqlobject;

import java.util.List;
import java.util.UUID;

import com.google.common.collect.Lists;

import org.jdbi.v3.Jdbi;
import org.jdbi.v3.Handle;
import org.jdbi.v3.exceptions.UnableToCreateStatementException;
import org.jdbi.v3.unstable.BindIn;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;

public class TestBindInParameter {

    private Jdbi dbi;
    private Handle handle;
    private MyDAO dao;

    @Before
    public void setUp() {
        dbi = Jdbi.create("jdbc:h2:mem:" + UUID.randomUUID());
        dbi.installPlugin(new SqlObjectPlugin());
        handle = dbi.open();
        handle.createStatement(
                "create table foo (id int, bar varchar(100) default null);")
                .execute();
        dao = dbi.onDemand(MyDAO.class);
    }

    @After
    public void tearDown() throws Exception {
        handle.execute("drop table foo");
        handle.close();
    }

    @Test(expected = UnableToCreateStatementException.class)
    public void testBrokenSyntax() {
        dao.broken();
    }

    @Test
    public void testWorks() {
        dao.works(Lists.newArrayList(1L, 2L));
    }

    @Test
    public void testIds() {
        dao.ids(Lists.newArrayList(1, 2));
    }

    public interface MyDAO {
        @SqlQuery("select * from foo where bar < 12 and id in (<ids>)")
        Object broken();

        @SqlQuery("select * from foo where bar \\< 12 and id in (<ids>)")
        Object works(@BindIn("ids") List<Long> ids);

        @SqlQuery("select * from foo where id in (<ids>)")
        Object ids(@BindIn("ids") List<Integer> ids);
    }
}<commit_msg>Fix test to have valid return types<commit_after>/*
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.jdbi.v3.sqlobject;

import java.util.List;
import java.util.UUID;

import org.jdbi.v3.Handle;
import org.jdbi.v3.Jdbi;
import org.jdbi.v3.exceptions.UnableToCreateStatementException;
import org.jdbi.v3.unstable.BindIn;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import com.google.common.collect.Lists;

public class TestBindInParameter {

    private Jdbi dbi;
    private Handle handle;
    private MyDAO dao;

    @Before
    public void setUp() {
        dbi = Jdbi.create("jdbc:h2:mem:" + UUID.randomUUID());
        dbi.installPlugin(new SqlObjectPlugin());
        handle = dbi.open();
        handle.createStatement(
                "create table foo (id int, bar varchar(100) default null);")
                .execute();
        dao = dbi.onDemand(MyDAO.class);
    }

    @After
    public void tearDown() throws Exception {
        handle.execute("drop table foo");
        handle.close();
    }

    @Test(expected = UnableToCreateStatementException.class)
    public void testBrokenSyntax() {
        dao.broken();
    }

    @Test
    public void testWorks() {
        dao.works(Lists.newArrayList(1L, 2L));
    }

    @Test
    public void testIds() {
        dao.ids(Lists.newArrayList(1, 2));
    }

    public interface MyDAO {
        @SqlQuery("select count(*) from foo where bar < 12 and id in (<ids>)")
        int broken();

        @SqlQuery("select count(*) from foo where bar \\< 12 and id in (<ids>)")
        int works(@BindIn("ids") List<Long> ids);

        @SqlQuery("select count(*) from foo where id in (<ids>)")
        int ids(@BindIn("ids") List<Integer> ids);
    }
}
{'fraction_non_alphanumeric': 0.1145413870246085, 'fraction_numerical': 0.009395973154362415, 'mean_word_length': 2.9116360454943133, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '3110763', 'n_tokens_mistral': 1393, 'n_tokens_neox': 1321, 'n_words': 419}