/*
 * 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);
    }
}

@@ -634,49 +634,8 @@
 D;%0A%0A
-import com.google.common.collect.Lists;%0A%0A
 impo
@@ -649,20 +649,22 @@
 jdbi.v3.
-Jdbi
+Handle
 ;%0Aimport
@@ -668,38 +668,36 @@
 ort org.jdbi.v3.
-Handle
+Jdbi
 ;%0Aimport org.jdb
@@ -855,16 +855,57 @@
 .Test;%0A%0A
+import com.google.common.collect.Lists;%0A%0A
 public c
@@ -1856,33 +1856,40 @@
 qlQuery(%22select 
-*
+count(*)
  from foo where 
@@ -1925,21 +1925,18 @@
         
-Objec
+in
 t broken
@@ -1958,33 +1958,40 @@
 qlQuery(%22select 
-*
+count(*)
  from foo where 
@@ -2029,21 +2029,18 @@
         
-Objec
+in
 t works(
@@ -2098,17 +2098,24 @@
 %22select 
-*
+count(*)
  from fo
@@ -2146,21 +2146,18 @@
         
-Objec
+in
 t ids(@B

Fix test to have valid return types