@ -65,6 +65,15 @@ class SqlBinaryValueTests {
@@ -65,6 +65,15 @@ class SqlBinaryValueTests {
verify ( ps ) . setBinaryStream ( 1 , content , 3L ) ;
}
@Test
void withInputStreamUndeterminedLength ( ) throws SQLException {
InputStream content = new ByteArrayInputStream ( new byte [ ] { 0 , 1 , 2 } ) ;
SqlBinaryValue value = new SqlBinaryValue ( content , - 1 ) ;
PreparedStatement ps = mock ( ) ;
value . setTypeValue ( ps , 1 , JdbcUtils . TYPE_UNKNOWN , null ) ;
verify ( ps ) . setBinaryStream ( 1 , content ) ;
}
@Test
void withInputStreamForBlob ( ) throws SQLException {
InputStream content = new ByteArrayInputStream ( new byte [ ] { 0 , 1 , 2 } ) ;
@ -74,6 +83,15 @@ class SqlBinaryValueTests {
@@ -74,6 +83,15 @@ class SqlBinaryValueTests {
verify ( ps ) . setBlob ( 1 , content , 3L ) ;
}
@Test
void withInputStreamForBlobUndeterminedLength ( ) throws SQLException {
InputStream content = new ByteArrayInputStream ( new byte [ ] { 0 , 1 , 2 } ) ;
SqlBinaryValue value = new SqlBinaryValue ( content , - 1 ) ;
PreparedStatement ps = mock ( ) ;
value . setTypeValue ( ps , 1 , Types . BLOB , null ) ;
verify ( ps ) . setBlob ( 1 , content ) ;
}
@Test
void withInputStreamSource ( ) throws SQLException {
InputStream content = new ByteArrayInputStream ( new byte [ ] { 0 , 1 , 2 } ) ;
@ -83,6 +101,15 @@ class SqlBinaryValueTests {
@@ -83,6 +101,15 @@ class SqlBinaryValueTests {
verify ( ps ) . setBinaryStream ( 1 , content , 3L ) ;
}
@Test
void withInputStreamSourceUndeterminedLength ( ) throws SQLException {
InputStream content = new ByteArrayInputStream ( new byte [ ] { 0 , 1 , 2 } ) ;
SqlBinaryValue value = new SqlBinaryValue ( ( ) - > content , - 1 ) ;
PreparedStatement ps = mock ( ) ;
value . setTypeValue ( ps , 1 , JdbcUtils . TYPE_UNKNOWN , null ) ;
verify ( ps ) . setBinaryStream ( 1 , content ) ;
}
@Test
void withInputStreamSourceForBlob ( ) throws SQLException {
InputStream content = new ByteArrayInputStream ( new byte [ ] { 0 , 1 , 2 } ) ;
@ -92,6 +119,15 @@ class SqlBinaryValueTests {
@@ -92,6 +119,15 @@ class SqlBinaryValueTests {
verify ( ps ) . setBlob ( 1 , content , 3L ) ;
}
@Test
void withInputStreamSourceForBlobUndeterminedLength ( ) throws SQLException {
InputStream content = new ByteArrayInputStream ( new byte [ ] { 0 , 1 , 2 } ) ;
SqlBinaryValue value = new SqlBinaryValue ( ( ) - > content , - 1 ) ;
PreparedStatement ps = mock ( ) ;
value . setTypeValue ( ps , 1 , Types . BLOB , null ) ;
verify ( ps ) . setBlob ( 1 , content ) ;
}
@Test
void withResource ( ) throws SQLException {
byte [ ] content = new byte [ ] { 0 , 1 , 2 } ;