package Ġcom . github . spe ky . core . table Ċ Ċ import Ġio . kot est . core . spec . style . Fun Spec Ċ import Ġio . kot est . matchers . shouldBe Ċ import Ġio . kot est . matchers . types . shouldBe InstanceOf Ċ import Ġjava . math . BigDecimal Ċ import Ġjava . sql . Time Ċ import Ġjava . time . Instant Ċ import Ġjava . time . LocalDateTime Ċ import Ġjava . time . Local Time Ċ import Ġjava . util .* Ċ Ċ internal Ġclass ĠSql Value Test Ġ: ĠFun Spec ({ ĊĠ Ġtest (" test ĠSql Values ") Ġ{ ĊĠĠĠ Ġval Ġshort Ġ= ĠSql Value . Short ( 1 ) ĊĠĠĠ Ġval Ġint Ġ= ĠSql Value . Int ( 2 ) ĊĠĠĠ Ġval Ġbigint Ġ= ĠSql Value . Big int ( 3 3 ) ĊĠĠĠ Ġval Ġfloat Ġ= ĠSql Value . Float ( 1 2 . 3 f ) ĊĠĠĠ Ġval Ġreal Ġ= ĠSql Value . Real ( 1 1 . 3 ) ĊĠĠĠ Ġval Ġdouble Ġ= ĠSql Value . Double ( 2 3 . 3 ) ĊĠĠĠ Ġval Ġnumeric Ġ= ĠSql Value . Numeric ( 1 2 1 . 2 ) ĊĠĠĠ Ġval Ġdecimal Ġ= ĠSql Value . Decimal ( BigDecimal . TEN ) ĊĠĠĠ Ġval Ġvarchar Ġ= ĠSql Value . V arch ar (" Name ") ĊĠĠĠ Ġval Ġtext Ġ= ĠSql Value . Text (" Long Ġtext ") ĊĠĠĠ Ġval Ġdate Ġ= ĠSql Value . Date ( Date ()) ĊĠĠĠ Ġval Ġtime Ġ= ĠSql Value . Time ( Time . valueOf ( Local Time . now ())) ĊĠĠĠ Ġval Ġtimestamp Ġ= ĠSql Value . Timestamp ( Instant . now ()) ĊĠĠĠ Ġval Ġbinary Ġ= ĠSql Value . Binary ( ByteArray ( 1 0 )) ĊĠĠĠ Ġval Ġuuid Ġ= ĠSql Value . UUID ( UUID . randomUUID ()) ĊĠĠĠ Ġval Ġarray Ġ= ĠSql Value . Array ( array Of ( 1 , Ġ 2 , Ġ 3 , Ġ 4 , Ġ 5 )) ĊĠĠĠ Ġval Ġblob Ġ= ĠSql Value . Blob ( ByteArray ( 2 )) ĊĠĠĠ Ġval Ġboolean Ġ= ĠSql Value . Boolean ( true ) ĊĠĠĠ Ġval Ġtime z Ġ= ĠSql Value . Time z ( Local Time . now ()) ĊĠĠĠ Ġval Ġtimestamp z Ġ= ĠSql Value . Timestamp z ( LocalDateTime . now ()) ĊĊĠĠĠ Ġshort . value . shouldBe InstanceOf < Short >() ĊĠĠĠ Ġint . value . shouldBe InstanceOf < Int >() ĊĠĠĠ Ġbigint . value . shouldBe InstanceOf < Long >() ĊĠĠĠ Ġfloat . value . shouldBe InstanceOf < Float >() ĊĠĠĠ Ġreal . value . shouldBe InstanceOf < Double >() ĊĠĠĠ Ġdouble . value . shouldBe InstanceOf < Double >() ĊĠĠĠ Ġnumeric . value . shouldBe InstanceOf < Double >() ĊĠĠĠ Ġdecimal . value . shouldBe InstanceOf < BigDecimal >() ĊĠĠĠ Ġvarchar . value . shouldBe InstanceOf < String >() ĊĠĠĠ Ġtext . value . shouldBe InstanceOf < String >() ĊĠĠĠ Ġdate . value . shouldBe InstanceOf < Date >() ĊĠĠĠ Ġtime . value . shouldBe InstanceOf < Time >() ĊĠĠĠ Ġtimestamp . value . shouldBe InstanceOf < Instant >() ĊĠĠĠ Ġbinary . value . shouldBe InstanceOf < ByteArray >() ĊĠĠĠ Ġuuid . value . shouldBe InstanceOf < UUID >() ĊĠĠĠ Ġarray . value . shouldBe InstanceOf < Array < out ĠAny >>() ĊĠĠĠ Ġblob . value . shouldBe InstanceOf < ByteArray >() ĊĠĠĠ Ġboolean . value . shouldBe InstanceOf < Boolean >() ĊĠĠĠ Ġtime z . value . shouldBe InstanceOf < Local Time >() ĊĠĠĠ Ġtimestamp z . value . shouldBe InstanceOf < LocalDateTime >() ĊĊĠĠĠ Ġshort . type ĠshouldBe ĠSql Type . Small Int ĊĠĠĠ Ġint . type ĠshouldBe ĠSql Type . Integer ĊĠĠĠ Ġbigint . type ĠshouldBe ĠSql Type . Big int ĊĠĠĠ Ġfloat . type ĠshouldBe ĠSql Type . Float ĊĠĠĠ Ġreal . type ĠshouldBe ĠSql Type . Real ĊĠĠĠ Ġdouble . type ĠshouldBe ĠSql Type . Double ĊĠĠĠ Ġnumeric . type ĠshouldBe ĠSql Type . Numeric ĊĠĠĠ Ġdecimal . type ĠshouldBe ĠSql Type . Decimal ĊĠĠĠ Ġvarchar . type ĠshouldBe ĠSql Type . V arch ar ĊĠĠĠ Ġtext . type ĠshouldBe ĠSql Type . Long V arch ar ĊĠĠĠ Ġdate . type ĠshouldBe ĠSql Type . Date ĊĠĠĠ Ġtime . type ĠshouldBe ĠSql Type . Time ĊĠĠĠ Ġtimestamp . type ĠshouldBe ĠSql Type . Timestamp ĊĠĠĠ Ġbinary . type ĠshouldBe ĠSql Type . Binary ĊĠĠĠ Ġuuid . type ĠshouldBe ĠSql Type . Other ĊĠĠĠ Ġarray . type ĠshouldBe ĠSql Type . Array ĊĠĠĠ Ġblob . type ĠshouldBe ĠSql Type . Blob ĊĠĠĠ Ġboolean . type ĠshouldBe ĠSql Type . Boolean ĊĠĠĠ Ġtime z . type ĠshouldBe ĠSql Type . Time With TimeZone ĊĠĠĠ Ġtimestamp z . type ĠshouldBe ĠSql Type . Timestamp With TimeZone ĊĠ Ġ} ĊĊĠ Ġtest (" Sql Values ĠValue Transformer Ġinstance ") Ġ{ ĊĠĠĠ Ġval Ġshort Ġ= ĠSql Value . Short . transformer ĊĠĠĠ Ġval Ġint Ġ= ĠSql Value . Int . transformer ĊĠĠĠ Ġval Ġbigint Ġ= ĠSql Value . Big int . transformer ĊĠĠĠ Ġval Ġfloat Ġ= ĠSql Value . Float . transformer ĊĠĠĠ Ġval Ġreal Ġ= ĠSql Value . Real . transformer ĊĠĠĠ Ġval Ġdouble Ġ= ĠSql Value . Double . transformer ĊĠĠĠ Ġval Ġnumeric Ġ= ĠSql Value . Numeric . transformer ĊĠĠĠ Ġval Ġdecimal Ġ= ĠSql Value . Decimal . transformer ĊĠĠĠ Ġval Ġvarchar Ġ= ĠSql Value . V arch ar . transformer ĊĠĠĠ Ġval Ġtext Ġ= ĠSql Value . Text . transformer ĊĠĠĠ Ġval Ġdate Ġ= ĠSql Value . Date . transformer ĊĠĠĠ Ġval Ġtime Ġ= ĠSql Value . Time . transformer ĊĠĠĠ Ġval Ġtimestamp Ġ= ĠSql Value . Timestamp . transformer ĊĠĠĠ Ġval Ġbinary Ġ= ĠSql Value . Binary . transformer ĊĠĠĠ Ġval Ġuuid Ġ= ĠSql Value . UUID . transformer ĊĠĠĠ Ġval Ġarray Ġ= ĠSql Value . Array . transformer ĊĠĠĠ Ġval Ġblob Ġ= ĠSql Value . Blob . transformer ĊĠĠĠ Ġval Ġboolean Ġ= ĠSql Value . Boolean . transformer ĊĠĠĠ Ġval Ġtime z Ġ= ĠSql Value . Time z . transformer ĊĠĠĠ Ġval Ġtimestamp z Ġ= ĠSql Value . Timestamp z . transformer ĊĊĠĠĠ Ġshort . shouldBe InstanceOf < Value Transformer < Short , ĠSql Value . Short >>() ĊĠĠĠ Ġint . shouldBe InstanceOf < Value Transformer < Int , ĠSql Value . Int >>() ĊĠĠĠ Ġbigint . shouldBe InstanceOf < Value Transformer < Long , ĠSql Value . Binary >>() ĊĠĠĠ Ġfloat . shouldBe InstanceOf < Value Transformer < Float , ĠSql Value . Float >>() ĊĠĠĠ Ġreal . shouldBe InstanceOf < Value Transformer < Double , ĠSql Value . Real >>() ĊĠĠĠ Ġdouble . shouldBe InstanceOf < Value Transformer < Double , ĠSql Value . Double >>() ĊĠĠĠ Ġnumeric . shouldBe InstanceOf < Value Transformer < Double , ĠSql Value . Numeric >>() ĊĠĠĠ Ġdecimal . shouldBe InstanceOf < Value Transformer < BigDecimal , ĠSql Value . Decimal >>() ĊĠĠĠ Ġvarchar . shouldBe InstanceOf < Value Transformer < String , ĠSql Value . V arch ar >>() ĊĠĠĠ Ġtext . shouldBe InstanceOf < Value Transformer < String , ĠSql Value . Text >>() ĊĠĠĠ Ġdate . shouldBe InstanceOf < Value Transformer < Date , ĠSql Value . Date >>() ĊĠĠĠ Ġtime . shouldBe InstanceOf < Value Transformer < Time , ĠSql Value . Time >>() ĊĠĠĠ Ġtimestamp . shouldBe InstanceOf < Value Transformer < Instant , ĠSql Value . Timestamp >>() ĊĠĠĠ Ġbinary . shouldBe InstanceOf < Value Transformer < ByteArray , ĠSql Value . Binary >>() ĊĠĠĠ Ġuuid . shouldBe InstanceOf < Value Transformer < UUID , ĠSql Value . UUID >>() ĊĠĠĠ Ġarray . shouldBe InstanceOf < Value Transformer < Array < out ĠAny >, ĠSql Value . Array >>() ĊĠĠĠ Ġblob . shouldBe InstanceOf < Value Transformer < ByteArray , ĠSql Value . Blob >>() ĊĠĠĠ Ġboolean . shouldBe InstanceOf < Value Transformer < Boolean , ĠSql Value . Boolean >>() ĊĠĠĠ Ġtime z . shouldBe InstanceOf < Value Transformer < Local Time , ĠSql Value . Time z >>() ĊĠĠĠ Ġtimestamp z . shouldBe InstanceOf < Value Transformer < LocalDateTime , ĠSql Value . Timestamp z >>() ĊĊĠĠĠ Ġval Ġtest Time Ġ= ĠTime . valueOf ( Local Time . now ()) ĊĠĠĠ Ġval Ġinstant Ġ= ĠInstant . now () ĊĠĠĠ Ġval Ġtest UUID Ġ= ĠUUID . randomUUID () ĊĠĠĠ Ġval Ġlocal Time Ġ= ĠLocal Time . now () ĊĠĠĠ Ġval Ġlocal DateTime Ġ= ĠLocalDateTime . now () ĊĠĠĠ Ġval Ġtest Binary Ġ= ĠByteArray ( 2 ) ĊĊĠĠĠ Ġshort . to Sql Value ( 1 ) ĠshouldBe ĠSql Value . Short ( 1 ) ĊĠĠĠ Ġint . to Sql Value ( 1 ) ĠshouldBe ĠSql Value . Int ( 1 ) ĊĠĠĠ Ġbigint . to Sql Value ( 1 ) ĠshouldBe ĠSql Value . Big int ( 1 ) ĊĠĠĠ Ġfloat . to Sql Value ( 1 . 5 f ) ĠshouldBe ĠSql Value . Float ( 1 . 5 f ) ĊĠĠĠ Ġreal . to Sql Value ( 1 . 3 4 ) ĠshouldBe ĠSql Value . Real ( 1 . 3 4 ) ĊĠĠĠ Ġdouble . to Sql Value ( 1 . 3 2 ) ĠshouldBe ĠSql Value . Double ( 1 . 3 2 ) ĊĠĠĠ Ġnumeric . to Sql Value ( 1 . 2 2 ) ĠshouldBe ĠSql Value . Numeric ( 1 . 2 2 ) ĊĠĠĠ Ġdecimal . to Sql Value ( BigDecimal . TEN ) ĠshouldBe ĠSql Value . Decimal ( BigDecimal . TEN ) ĊĠĠĠ Ġvarchar . to Sql Value (" name ") ĠshouldBe ĠSql Value . V arch ar (" name ") ĊĠĠĠ Ġtext . to Sql Value (" Long Ġtext ") ĠshouldBe ĠSql Value . Text (" Long Ġtext ") ĊĠĠĠ Ġdate . to Sql Value ( Date ( 2 0 )) ĠshouldBe ĠSql Value . Date ( Date ( 2 0 )) ĊĠĠĠ Ġtime . to Sql Value ( test Time ) ĠshouldBe ĠSql Value . Time ( test Time ) ĊĠĠĠ Ġtimestamp . to Sql Value ( instant ) ĠshouldBe ĠSql Value . Timestamp ( instant ) ĊĠĠĠ Ġbinary . to Sql Value ( test Binary ). value ĠshouldBe ĠSql Value . Binary ( test Binary ). value ĊĠĠĠ Ġuuid . to Sql Value ( test UUID ) ĠshouldBe ĠSql Value . UUID ( test UUID ) ĊĠĠĠ Ġarray . to Sql Value ( array Of (" a ", Ġ" b ")). value ĠshouldBe ĠSql Value . Array ( array Of (" a ", Ġ" b ")). value ĊĠĠĠ Ġblob . to Sql Value ( test Binary ). value ĠshouldBe ĠSql Value . Blob ( test Binary ). value ĊĠĠĠ Ġboolean . to Sql Value ( true ) ĠshouldBe ĠSql Value . Boolean ( true ) ĊĠĠĠ Ġtime z . to Sql Value ( local Time ) ĠshouldBe ĠSql Value . Time z ( local Time ) ĊĠĠĠ Ġtimestamp z . to Sql Value ( local DateTime ) ĠshouldBe ĠSql Value . Timestamp z ( local DateTime ) ĊĊĠĠĠ Ġshort . from Sql Value ( Sql Value . Short ( 1 )) ĠshouldBe Ġ 1 ĊĠĠĠ Ġint . from Sql Value ( Sql Value . Int ( 1 )) ĠshouldBe Ġ 1 ĊĠĠĠ Ġbigint . from Sql Value ( Sql Value . Big int ( 1 )) ĠshouldBe Ġ 1 ĊĠĠĠ Ġfloat . from Sql Value ( Sql Value . Float ( 1 . 5 f )) ĠshouldBe Ġ 1 . 5 f ĊĠĠĠ Ġreal . from Sql Value ( Sql Value . Real ( 1 . 3 4 )) ĠshouldBe Ġ 1 . 3 4 ĊĠĠĠ Ġdouble . from Sql Value ( Sql Value . Double ( 1 . 3 2 )) ĠshouldBe Ġ 1 . 3 2 ĊĠĠĠ Ġnumeric . from Sql Value ( Sql Value . Numeric ( 1 . 2 2 )) ĠshouldBe Ġ 1 . 2 2 ĊĠĠĠ Ġdecimal . from Sql Value ( Sql Value . Decimal ( BigDecimal . TEN )) ĠshouldBe ĠBigDecimal . TEN ĊĠĠĠ Ġvarchar . from Sql Value ( Sql Value . V arch ar (" name ")) ĠshouldBe Ġ" name " ĊĠĠĠ Ġtext . from Sql Value ( Sql Value . Text (" Long Ġtext ")) ĠshouldBe Ġ" Long Ġtext " ĊĠĠĠ Ġdate . from Sql Value ( Sql Value . Date ( Date ( 2 0 ))) ĠshouldBe ĠDate ( 2 0 ) ĊĠĠĠ Ġtime . from Sql Value ( Sql Value . Time ( test Time )) ĠshouldBe Ġtest Time ĊĠĠĠ Ġtimestamp . from Sql Value ( Sql Value . Timestamp ( instant )) ĠshouldBe Ġinstant ĊĠĠĠ Ġbinary . from Sql Value ( Sql Value . Binary ( test Binary )) ĠshouldBe Ġtest Binary ĊĠĠĠ Ġuuid . from Sql Value ( Sql Value . UUID ( test UUID )) ĠshouldBe Ġtest UUID ĊĠĠĠ Ġarray . from Sql Value ( Sql Value . Array ( array Of (" a ", Ġ" b "))) ĠshouldBe ĠarrayOf (" a ", Ġ" b ") ĊĠĠĠ Ġblob . from Sql Value ( Sql Value . Blob ( test Binary )) ĠshouldBe Ġtest Binary ĊĠĠĠ Ġboolean . from Sql Value ( Sql Value . Boolean ( true )) ĠshouldBe Ġtrue ĊĠĠĠ Ġtime z . from Sql Value ( Sql Value . Time z ( local Time )) ĠshouldBe Ġlocal Time ĊĠĠĠ Ġtimestamp z . from Sql Value ( Sql Value . Timestamp z ( local DateTime )) ĠshouldBe Ġlocal DateTime ĊĠ Ġ} Ċ }) Ċ