/* Ċ Ġ* ĠCopyright Ġ 2 0 1 9 ĠAmazon . com , ĠInc . Ġor Ġits Ġaffiliates . Ġ ĠAll Ġrights Ġreserved . Ċ Ġ* Ċ Ġ* ĠLicensed Ġunder Ġthe ĠApache ĠLicense , ĠVersion Ġ 2 . 0 Ġ( the Ġ" License "). Ċ Ġ* Ġ ĠYou Ġmay Ġnot Ġuse Ġthis Ġfile Ġexcept Ġin Ġcompliance Ġwith Ġthe ĠLicense . Ċ Ġ* ĠA Ġcopy Ġof Ġthe ĠLicense Ġis Ġlocated Ġat : Ċ Ġ* Ċ Ġ* ĠĠĠĠĠ Ġhttp :// aws . amazon . com / apache 2 . 0 / Ċ Ġ* Ċ Ġ* Ġ Ġor Ġin Ġthe Ġ" license " Ġfile Ġaccompanying Ġthis Ġfile . ĠThis Ġfile Ġ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 . part i ql . lang . eval . builtins Ċ Ċ import Ġcom . amazon . ion . system .* Ċ import Ġorg . part i ql . lang . eval .* Ċ import Ġorg . part i ql . lang . util .* Ċ import Ġorg . assertj . core . api . Assertions .* Ċ import Ġorg . junit .* Ċ import Ġorg . junit . Assert .* Ċ import Ġorg . part i ql . lang .* Ċ Ċ /** Ċ Ġ* ĠTests Ġfor Ġ[ Trim Expr Function ], Ġmost Ġtests Ġare Ġdone Ġe 2 e Ġthrough Ġthe Ġevaluator , Ġsee Ġ[ Builtin Functions Test ] Ċ Ġ*/ Ċ class ĠTrim Expr Function Test Ġ: ĠTest Base () Ġ{ ĊĠĠĠ Ġprivate Ġval Ġenv Ġ= ĠEnvironment . standard () ĊĊĠĠĠ Ġprivate Ġval Ġsubject Ġ= ĠTrim Expr Function ( value Factory ) ĊĊĠĠĠ Ġprivate Ġfun Ġcall Trim ( var arg Ġargs : ĠAny ) Ġ= Ġsubject . call ( env , Ġargs . map Ġ{ Ġany To Expr Value ( it ) Ġ}. toList ()). stringValue () ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġone Argument () Ġ= ĠassertEquals (" string ", Ġcall Trim (" ĠĠ Ġstring ĠĠ Ġ")) ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtwo Arguments () Ġ= ĠassertEquals (" string ĠĠ Ġ", Ġcall Trim (" leading ", Ġ" ĠĠ Ġstring ĠĠ Ġ")) ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtwo Arguments 2 () Ġ= ĠassertEquals (" string ", Ġcall Trim (" 1 2 ", Ġ" 1 2 1 2 string 1 2 1 2 ")) ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtwo Arguments Both () Ġ= ĠassertEquals ("", Ġcall Trim (" both ", Ġ" ĠĠĠĠĠ Ġ")) ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtwo Arguments Leading () Ġ= ĠassertEquals ("", Ġcall Trim (" leading ", Ġ" ĠĠĠĠĠ Ġ")) ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtwo Arguments Trailing () Ġ= ĠassertEquals ("", Ġcall Trim (" trailing ", Ġ" ĠĠĠĠĠ Ġ")) ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġthree Arguments () Ġ= ĠassertEquals (" string ", Ġcall Trim (" both ", Ġ" a ", Ġ" aaaaaaaa aa string aaaa aaa ")) ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġzero Arguments () Ġ{ ĊĠĠĠĠĠĠĠ ĠassertThat Thrown By Ġ{ Ġcall Trim () Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. is Exactly InstanceOf ( Evaluation Exception :: class . java ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. has Message Containing (" trim Ġtakes Ġbetween Ġ 1 Ġand Ġ 3 Ġarguments , Ġreceived : Ġ 0 ") ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġmore Than Three Arguments () Ġ{ ĊĠĠĠĠĠĠĠ ĠassertThat Thrown By Ġ{ Ġcall Trim (" both ", Ġ" a ", Ġ" aaaaaaaa aa string aaaa aaa ", Ġ" a ") Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. is Exactly InstanceOf ( Evaluation Exception :: class . java ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. has Message Containing (" trim Ġtakes Ġbetween Ġ 1 Ġand Ġ 3 Ġarguments , Ġreceived : Ġ 4 ") ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġwrong Specification Type () Ġ{ ĊĠĠĠĠĠĠĠ ĠassertThat Thrown By Ġ{ ĠassertEquals (" string ", Ġcall Trim ( 1 , Ġ" string ")) Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. is Exactly InstanceOf ( Evaluation Exception :: class . java ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. has Message Containing (" with Ġtwo Ġarguments Ġtrim 's Ġfirst Ġargument Ġmust Ġbe Ġeither Ġthe Ġspecification Ġor Ġa Ġ' to Ġremove ' Ġstring ") ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġwrong Argument Type () Ġ{ ĊĠĠĠĠĠĠĠ ĠassertThat Thrown By Ġ{ ĠassertEquals (" string ", Ġcall Trim ( 1 )) Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. is Exactly InstanceOf ( Evaluation Exception :: class . java ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. has Message Containing (" Expected Ġtext : Ġ 1 ") ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġwrong ToRemove Type () Ġ{ ĊĠĠĠĠĠĠĠ ĠassertThat Thrown By Ġ{ ĠassertEquals (" string ", Ġcall Trim (" both ", Ġ 1 , Ġ" string ")) Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. is Exactly InstanceOf ( Evaluation Exception :: class . java ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. has Message Containing (" Expected Ġtext : Ġ 1 ") ĊĠĠĠ Ġ} Ċ }