/* Ċ Ġ* ĠCopyright Ġ( C ) Ġ 2 0 1 8 ĠNu ĠEcho ĠInc Ċ Ġ* Ġ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 Ġcom . n ue cho . mut agen . cli . models . configuration Ċ Ċ import Ġcom . genes ys lab . platform . application blocks . com . objects . Cfg Folder Ċ import Ġcom . genes ys lab . platform . configuration . protocol . types . Cfg Folder Class . CFG FC Default Ċ import Ġcom . genes ys lab . platform . configuration . protocol . types . Cfg Object State . CFG Enabled Ċ import Ġcom . genes ys lab . platform . configuration . protocol . types . Cfg ObjectType . CFG Person Ċ import Ġcom . n ue cho . mut agen . cli . models . configuration . Configuration Object Mocks . DEFAULT _ FOLDER _ DB ID Ċ import Ġcom . n ue cho . mut agen . cli . models . configuration . Configuration Object Mocks . DEFAULT _ FOLDER _ REFERENCE Ċ import Ġcom . n ue cho . mut agen . cli . models . configuration . Configuration Object Mocks . DEFAULT _ TEN ANT _ DB ID Ċ import Ġcom . n ue cho . mut agen . cli . models . configuration . Configuration Object Mocks . mock KeyValue Collection Ċ import Ġcom . n ue cho . mut agen . cli . models . configuration . Configuration Objects . to Cfg Folder Class Ċ import Ġcom . n ue cho . mut agen . cli . models . configuration . Configuration Objects . to Cfg Object State Ċ import Ġcom . n ue cho . mut agen . cli . models . configuration . Configuration TestData . default Properties Ċ import Ġcom . n ue cho . mut agen . cli . models . configuration . reference . reference Set Builder Ċ import Ġcom . n ue cho . mut agen . cli . services . Conf Service Extension Mocks . mock Retrieve Folder By Db id Ċ import Ġcom . n ue cho . mut agen . cli . services . Conf Service Extension Mocks . mock Retrieve Tenant Ċ import Ġcom . n ue cho . mut agen . cli . services . Service Mocks . mock Conf Service Ċ import Ġcom . n ue cho . mut agen . cli . to ShortName Ċ import Ġio . mock k . every Ċ import Ġorg . hamcrest . Core Matchers . equalTo Ċ import Ġorg . hamcrest . Matcher Assert . assertThat Ċ import Ġorg . junit . jupiter . api . Test Ċ Ċ private Ġconst Ġval ĠF OLDER _ NAME Ġ= Ġ" name " Ċ private Ġval Ġfolder Ġ= ĠFolder ( ĊĠĠĠ Ġname Ġ= ĠF OLDER _ NAME , ĊĠĠĠ Ġtype Ġ= ĠCFG Person . to ShortName (), ĊĠĠĠ Ġdescription Ġ= Ġ" description ", ĊĠĠĠ Ġfolder Class Ġ= ĠCFG FC Default . to ShortName (), ĊĠĠĠ Ġcustom Type Ġ= Ġ 8 , ĊĠĠĠ Ġstate Ġ= ĠCFG Enabled . to ShortName (), ĊĠĠĠ Ġuser Properties Ġ= Ġdefault Properties (), ĊĠĠĠ Ġfolder Ġ= ĠDEFAULT _ FOLDER _ REFERENCE Ċ ) Ċ Ċ class ĠFolder Test Ġ: ĠConfiguration Object Test ( ĊĠĠĠ Ġconfiguration Object Ġ= Ġfolder , ĊĠĠĠ Ġempty Configuration Object Ġ= ĠFolder ( name Ġ= ĠF OLDER _ NAME , Ġtype Ġ= ĠCFG Person . to ShortName (), Ġfolder Ġ= ĠDEFAULT _ FOLDER _ REFERENCE ), ĊĠĠĠ Ġmandatory Properties Ġ= Ġempty Set (), ĊĠĠĠ Ġimported Configuration Object Ġ= ĠFolder ( mock Cfg Folder ()) Ċ ) Ġ{ ĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġoverride Ġfun Ġ` get References () Ġshould Ġreturn Ġall Ġobject 's Ġreferences `() Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġexpected Ġ= Ġreference Set Builder () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. add ( folder . folder ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. toSet () ĊĊĠĠĠĠĠĠĠ ĠassertThat ( folder . get References (), ĠequalTo ( expected )) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġoverride Ġfun Ġ` object Ġwith Ġdifferent Ġun change able Ġproperties ' Ġvalues Ġshould Ġreturn Ġthe Ġright Ġun change able Ġproperties `() Ġ= ĊĠĠĠĠĠĠĠ Ġassert Un change able Properties ( mock Cfg Folder (), ĠF OLDER ) ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` create Cfg Object Ġshould Ġproperly Ġcreate ĠC fg Folder `() Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġservice Ġ= Ġmock Conf Service () ĊĠĠĠĠĠĠĠ Ġmock Retrieve Tenant ( service ) ĊĠĠĠĠĠĠĠ Ġval Ġcfg Folder Ġ= Ġfolder . create Cfg Object ( service ) ĊĊĠĠĠĠĠĠĠ Ġwith ( cfg Folder ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertThat ( name , ĠequalTo ( folder . name )) ĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertThat ( type , ĠequalTo ( CFG Person )) ĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertThat ( description , ĠequalTo ( folder . description )) ĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertThat ( folder Class , ĠequalTo ( to Cfg Folder Class ( folder . folder Class ))) ĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertThat ( custom Type , ĠequalTo ( folder . custom Type )) ĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertThat ( state , ĠequalTo ( to Cfg Object State ( folder . state ))) ĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertThat ( user Properties . as Categor ized Properties (), ĠequalTo ( folder . user Properties )) ĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertThat ( folder Id , ĠequalTo ( DEFAULT _ FOLDER _ DB ID )) ĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertThat ( owner ID . db id , ĠequalTo ( DEFAULT _ TEN ANT _ DB ID )) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} Ċ } Ċ Ċ private Ġfun Ġmock Cfg Folder (): ĠC fg Folder Ġ{ ĊĠĠĠ Ġval Ġservice Ġ= Ġmock Conf Service () ĊĠĠĠ Ġmock Retrieve Folder By Db id ( service ) ĊĊĠĠĠ Ġreturn ĠConfiguration Object Mocks . mock Cfg Folder ( folder . name ). apply Ġ{ ĊĠĠĠĠĠĠĠ Ġevery Ġ{ Ġconfiguration Service Ġ} Ġreturns Ġservice ĊĠĠĠĠĠĠĠ Ġevery Ġ{ Ġname Ġ} Ġreturns Ġfolder . name ĊĠĠĠĠĠĠĠ Ġevery Ġ{ Ġtype Ġ} Ġreturns ĠCFG Person ĊĠĠĠĠĠĠĠ Ġevery Ġ{ Ġdescription Ġ} Ġreturns Ġfolder . description ĊĠĠĠĠĠĠĠ Ġevery Ġ{ Ġfolder Class Ġ} Ġreturns Ġto Cfg Folder Class ( folder . folder Class ) ĊĠĠĠĠĠĠĠ Ġevery Ġ{ Ġcustom Type Ġ} Ġreturns Ġfolder . custom Type ĊĠĠĠĠĠĠĠ Ġevery Ġ{ Ġstate Ġ} Ġreturns Ġto Cfg Object State ( folder . state ) ĊĠĠĠĠĠĠĠ Ġevery Ġ{ Ġuser Properties Ġ} Ġreturns Ġmock KeyValue Collection () ĊĠĠĠĠĠĠĠ Ġevery Ġ{ Ġfolder Id Ġ} Ġreturns ĠDEFAULT _ FOLDER _ DB ID ĊĠĠĠ Ġ} Ċ } Ċ