/* Ċ Ġ* ĠCopyright Ġ 2 0 1 2 - 2 0 1 8 Ġthe Ġoriginal Ġauthor Ġor Ġauthors . Ċ Ġ* Ċ Ġ* ĠLicensed Ġunder Ġthe ĠApache ĠLicense , ĠVersion Ġ 2 . 0 Ġ( the Ġ" License "); Ċ Ġ* Ġyou Ġmay Ġnot Ġuse Ġthis Ġfile Ġexcept Ġin Ġcompliance Ġwith Ġthe ĠLicense . Ċ Ġ* ĠYou Ġmay Ġobtain Ġa Ġcopy Ġof Ġthe ĠLicense Ġat Ċ Ġ* Ċ Ġ* ĠĠĠĠĠĠ Ġhttp :// www . apache . org / licenses / LICENSE - 2 . 0 Ċ Ġ* Ċ Ġ* ĠUnless Ġrequired Ġby Ġapplicable Ġlaw Ġor Ġagreed Ġto Ġin Ġwriting , Ġsoftware Ċ Ġ* Ġdistributed Ġunder Ġthe ĠLicense Ġ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 . nex ial . core . plugins . web Ċ Ċ import Ġorg . junit . Assert Ċ import Ġorg . junit . Test Ċ import Ġorg . nex ial . core . N ex ial Const . Data . Save Grid As CSV . DATA _ TRIM Ċ import Ġorg . nex ial . core . model . ExecutionContext Ċ import Ġorg . nex ial . core . model . Mock ExecutionContext Ċ Ċ class ĠTable Helper Test Ġ{ ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġcsv Safe () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġcontext Ġ= ĠMock ExecutionContext ( true ) ĊĠĠĠĠĠĠĠ Ġcontext . setData ( DATA _ TRIM , Ġtrue ) ĊĊĠĠĠĠĠĠĠ Ġval Ġweb Command Ġ= Ġobject Ġ: ĠWeb Command () Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġoverride Ġfun ĠgetContext (): ĠExecutionContext Ġ= Ġcontext ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠ Ġval Ġsubject Ġ= ĠTable Helper ( web Command ) ĊĊĠĠĠĠĠĠĠ ĠAssert . assertEquals ("", Ġsubject . csv Safe ("")) ĊĠĠĠĠĠĠĠ ĠAssert . assertEquals ("", Ġsubject . csv Safe (" Ġ")) ĊĠĠĠĠĠĠĠ ĠAssert . assertEquals ("", Ġsubject . csv Safe ("\ t ")) ĊĠĠĠĠĠĠĠ ĠAssert . assertEquals ("", Ġsubject . csv Safe ("\ n ")) ĊĠĠĠĠĠĠĠ ĠAssert . assertEquals ("", Ġsubject . csv Safe ("\ r \ n ")) ĊĠĠĠĠĠĠĠ ĠAssert . assertEquals ("", Ġsubject . csv Safe ("\ r \ n Ġ")) ĊĠĠĠĠĠĠĠ ĠAssert . assertEquals ("", Ġsubject . csv Safe (" Ġ\ r \ n ")) ĊĠĠĠĠĠĠĠ ĠAssert . assertEquals ("", Ġsubject . csv Safe (" Ġ\ r \ n Ġ")) ĊĠĠĠĠĠĠĠ ĠAssert . assertEquals ("", Ġsubject . csv Safe (" Ġ\ t \ n Ġ")) ĊĊĠĠĠĠĠĠĠ ĠAssert . assertEquals (" Net Ġ( Take - Home )", Ġsubject . csv Safe (" Net \ n ( Take - Home ) Ġ")) ĊĠĠĠĠĠĠĠ ĠAssert . assertEquals (" Net Ġ( Take - Home )", Ġsubject . csv Safe (" Net \ n Ġ( Take - Home ) Ġ")) ĊĠĠĠĠĠĠĠ ĠAssert . assertEquals (" Net Ġ( Take - Home )", Ġsubject . csv Safe (" Net Ġ\ n ( Take - Home ) Ġ")) ĊĠĠĠĠĠĠĠ ĠAssert . assertEquals (" Net Ġ( Take - Home )", Ġsubject . csv Safe (" Net Ġ\ n Ġ( Take - Home ) Ġ")) ĊĠĠĠĠĠĠĠ ĠAssert . assertEquals (" Net Ġ( Take - Home )", Ġsubject . csv Safe ("\ t Net Ġ\ r \ n Ġ( Take - Home ) Ġ")) ĊĠĠĠĠĠĠĠ ĠAssert . assertEquals (" Net Ġ( Take - Home )", Ġsubject . csv Safe ("\ t Net Ġ\ r Ġ( Take - Home )\ t \ t ")) ĊĊĠĠĠĠĠĠĠ ĠAssert . assertEquals (" 3 , 2 1 . 5 6 ", Ġsubject . csv Safe ("\ t 3 , 2 1 . 5 6 \ t \ t ")) ĊĠĠĠĠĠĠĠ ĠAssert . assertEquals (" a , b , c , Ġd , Ġe ", Ġsubject . csv Safe ("\ ta , b , c ,\ td ,\ ne \ t \ t ")) ĊĠĠĠĠĠĠĠ ĠAssert . assertEquals (" Tom , Ġthe Ġ\" tom - tom \" Ġguide ", Ġsubject . csv Safe ("\ t Tom , Ġthe Ġ\" tom - tom \" Ġguide \ t \ t ")) ĊĊĠĠĠĠĠĠĠ Ġcontext . setData ( DATA _ TRIM , Ġfalse ) ĊĠĠĠĠĠĠĠ ĠAssert . assertEquals (" ĠTom , Ġthe Ġ\" tom - tom \" Ġguide Ġ Ġ", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġsubject . csv Safe ("\ t Tom , Ġthe Ġ\" tom - tom \" Ġguide \ t \ t ")) ĊĠĠĠĠĠĠĠ ĠAssert . assertEquals (" 1 5 , 2 2 . 1 ", Ġsubject . csv Safe (" 1 5 , 2 2 . 1 ")) ĊĠĠĠĠĠĠĠ ĠAssert . assertEquals (" 1 5 , 2 2 . 1 Ġ Ġ", Ġsubject . csv Safe (" 1 5 , 2 2 . 1 Ġ Ġ\ t ")) ĊĠĠĠ Ġ} Ċ }