@@ -0,0 +1,2255 @@
+/*%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A * http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0Apackage org.jdbi.v3.core.array;%0A%0Aimport java.sql.Array;%0Aimport java.sql.PreparedStatement;%0Aimport java.sql.SQLException;%0Aimport java.sql.Types;%0Aimport org.jdbi.v3.core.argument.Argument;%0Aimport org.jdbi.v3.core.argument.Arguments;%0Aimport org.jdbi.v3.core.rule.DatabaseRule;%0Aimport org.jdbi.v3.core.rule.H2DatabaseRule;%0Aimport org.junit.Rule;%0Aimport org.junit.Test;%0Aimport org.mockito.Mock;%0Aimport org.mockito.junit.MockitoJUnit;%0Aimport org.mockito.junit.MockitoRule;%0A%0Aimport static org.mockito.ArgumentMatchers.any;%0Aimport static org.mockito.ArgumentMatchers.anyInt;%0Aimport static org.mockito.ArgumentMatchers.eq;%0Aimport static org.mockito.Mockito.never;%0Aimport static org.mockito.Mockito.verify;%0A%0Apublic class ByteArrayTest %7B%0A    @Rule%0A    public DatabaseRule db = new H2DatabaseRule();%0A    @Rule%0A    public MockitoRule mockito = MockitoJUnit.rule();%0A    @Mock%0A    private PreparedStatement stmt;%0A%0A    @Test%0A    public void byteArrayIsTypedAsVarbinary() throws SQLException %7B%0A        Argument nullByteArrayArg = db.getJdbi().withHandle(h -%3E h.getConfig(Arguments.class).findFor(byte%5B%5D.class, new byte%5B%5D %7B1%7D)).get();%0A%0A        nullByteArrayArg.apply(0, stmt, null);%0A%0A        verify(stmt, never()).setArray(anyInt(), any(Array.class));%0A        verify(stmt).setBytes(anyInt(), any(byte%5B%5D.class));%0A    %7D%0A%0A    @Test%0A    public void nullByteArrayIsTypedAsVarbinary() throws SQLException %7B%0A        Argument nullByteArrayArg = db.getJdbi().withHandle(h -%3E h.getConfig(Arguments.class).findFor(byte%5B%5D.class, null)).get();%0A%0A        nullByteArrayArg.apply(0, stmt, null);%0A%0A        verify(stmt, never()).setNull(anyInt(), eq(Types.ARRAY));%0A        verify(stmt).setNull(anyInt(), eq(Types.VARBINARY));%0A    %7D%0A%7D%0A

test #1038