@Override @Test public void shouldGetResultFromResultSetByPosition() throws Exception { byte[] byteArray = new byte[]{1, 2}; when(rs.getBlob(1)).thenReturn(blob); when(rs.wasNull()).thenReturn(false); when(blob.length()).thenReturn((long)byteArray.length); when(blob.getBytes(1, 2)).thenReturn(byteArray); assertThat(TYPE_HANDLER.getResult(rs, 1), is(new Byte[]{1, 2})); }
private Byte[] getBytes(Blob blob) throws SQLException { Byte[] returnValue = null; if (blob != null) { returnValue = ByteArrayUtils.convertToObjectArray(blob.getBytes(1, (int) blob.length())); } return returnValue; }
BlobByteObjectArrayTypeHandler extends BaseTypeHandler<Byte[]> { private Byte[] getBytes(Blob blob) throws SQLException { Byte[] returnValue = null; if (blob != null) { returnValue = ByteArrayUtils.convertToObjectArray(blob.getBytes(1, (int) blob.length())); } return returnValue; } }
BlobByteObjectArrayTypeHandler extends BaseTypeHandler<Byte[]> { private Byte[] getBytes(Blob blob) throws SQLException { Byte[] returnValue = null; if (blob != null) { returnValue = ByteArrayUtils.convertToObjectArray(blob.getBytes(1, (int) blob.length())); } return returnValue; }  }
BlobByteObjectArrayTypeHandler extends BaseTypeHandler<Byte[]> { private Byte[] getBytes(Blob blob) throws SQLException { Byte[] returnValue = null; if (blob != null) { returnValue = ByteArrayUtils.convertToObjectArray(blob.getBytes(1, (int) blob.length())); } return returnValue; }  @Override void setNonNullParameter(PreparedStatement ps, int i, Byte[] parameter, JdbcType jdbcType); @Override Byte[] getNullableResult(ResultSet rs, int columnIndex); @Override JdbcType getJdbcType(); }
BlobByteObjectArrayTypeHandler extends BaseTypeHandler<Byte[]> { private Byte[] getBytes(Blob blob) throws SQLException { Byte[] returnValue = null; if (blob != null) { returnValue = ByteArrayUtils.convertToObjectArray(blob.getBytes(1, (int) blob.length())); } return returnValue; }  @Override void setNonNullParameter(PreparedStatement ps, int i, Byte[] parameter, JdbcType jdbcType); @Override Byte[] getNullableResult(ResultSet rs, int columnIndex); @Override JdbcType getJdbcType();  }