/* Ċ Ġ* ĠCopyright Ġ( C ) Ġ 2 0 1 6 - 2 0 1 8 ĠRe ece ĠH . ĠD un n Ċ Ġ* Ċ Ġ* Ġ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 Ġuk . co . re ec ed un n . intellij . plugin . x query . tests . project . settings Ċ Ċ import Ġcom . intellij . util . xml b . Xml Serializer Ċ import Ġorg . hamcrest . Core Matchers .` is ` Ċ import Ġorg . j dom . output . XM LO ut put ter Ċ import Ġorg . junit . jupiter . api . DisplayName Ċ import Ġorg . junit . jupiter . api . Test Ċ import Ġuk . co . re ec ed un n . intellij . plugin . core . tests . assertion . assertThat Ċ import Ġuk . co . re ec ed un n . intellij . plugin . intellij . lang . Mark Logic Ċ import Ġuk . co . re ec ed un n . intellij . plugin . intellij . lang . W 3 C Ċ import Ġuk . co . re ec ed un n . intellij . plugin . intellij . lang . X Query Spec Ċ import Ġuk . co . re ec ed un n . intellij . plugin . x query . project . settings . X Query Project Settings Ċ Ċ @ DisplayName (" Int elli J Ġ- ĠSettings Ġ- ĠLanguage s Ġand ĠFramework s Ġ- ĠX Query ĠProject ĠSettings ") Ċ class ĠX Query Project Settings Test Ġ{ ĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġ@ DisplayName (" default Ġvalues ") ĊĠĠĠ Ġfun Ġtest Default Values () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġsettings Ġ= ĠX Query Project Settings () ĊĠĠĠĠĠĠĠ ĠassertThat ( settings . implementation Version , Ġ` is ` (" w 3 c / spec / v 1 ed ")) ĊĠĠĠĠĠĠĠ ĠassertThat ( settings . X Query Version , Ġ` is `( X Query Spec . REC _ 1 _ 0 _ 2 0 0 7 0 1 2 3 . version Id )) ĊĠĠĠĠĠĠĠ ĠassertThat ( settings . X Query 1 0 Dialect , Ġ` is `( X Query Spec . id )) ĊĠĠĠĠĠĠĠ ĠassertThat ( settings . X Query 3 0 Dialect , Ġ` is `( X Query Spec . id )) ĊĠĠĠĠĠĠĠ ĠassertThat ( settings . X Query 3 1 Dialect , Ġ` is `( X Query Spec . id )) ĊĊĠĠĠĠĠĠĠ ĠassertThat ( settings . product , Ġ` is `( W 3 C . SPEC IFICATION S )) ĊĠĠĠĠĠĠĠ ĠassertThat ( settings . product Version , Ġ` is `( W 3 C . FIRST _ ED ITION )) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġ@ DisplayName (" state ; Ġget ") ĊĠĠĠ Ġfun ĠtestGet State () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġsettings Ġ= ĠX Query Project Settings () ĊĠĠĠĠĠĠĠ ĠassertThat ( settings . state , Ġ` is `( settings )) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġ@ DisplayName (" state ; Ġload ") ĊĠĠĠ Ġfun Ġtest Load State () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġother Ġ= ĠX Query Project Settings () ĊĠĠĠĠĠĠĠ Ġother . implementation Version Ġ= Ġ" mark logic / v 6 " ĊĠĠĠĠĠĠĠ Ġother . X Query Version Ġ= ĠX Query Spec . MARK LOGIC _ 0 _ 9 . version Id ĊĠĠĠĠĠĠĠ Ġother . X Query 1 0 Dialect Ġ= ĠMark Logic . id ĊĠĠĠĠĠĠĠ Ġother . X Query 3 0 Dialect Ġ= ĠMark Logic . id ĊĠĠĠĠĠĠĠ Ġother . X Query 3 1 Dialect Ġ= ĠMark Logic . id ĊĊĠĠĠĠĠĠĠ Ġval Ġsettings Ġ= ĠX Query Project Settings () ĊĠĠĠĠĠĠĠ Ġsettings . load State ( other ) ĊĠĠĠĠĠĠĠ ĠassertThat ( settings . implementation Version , Ġ` is ` (" mark logic / v 6 ")) ĊĠĠĠĠĠĠĠ ĠassertThat ( settings . X Query Version , Ġ` is `( X Query Spec . MARK LOGIC _ 0 _ 9 . version Id )) ĊĠĠĠĠĠĠĠ ĠassertThat ( settings . X Query 1 0 Dialect , Ġ` is `( Mark Logic . id )) ĊĠĠĠĠĠĠĠ ĠassertThat ( settings . X Query 3 0 Dialect , Ġ` is `( Mark Logic . id )) ĊĠĠĠĠĠĠĠ ĠassertThat ( settings . X Query 3 1 Dialect , Ġ` is `( Mark Logic . id )) ĊĊĠĠĠĠĠĠĠ ĠassertThat ( settings . product , Ġ` is `( Mark Logic . MARK LOGIC )) ĊĠĠĠĠĠĠĠ ĠassertThat ( settings . product Version , Ġ` is `( Mark Logic . VERSION _ 6 _ 0 )) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġ@ DisplayName (" transient Ġproperties ") ĊĠĠĠ Ġfun Ġtest Transient Properties () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġsettings Ġ= ĠX Query Project Settings () ĊĠĠĠĠĠĠĠ Ġsettings . implementation Version Ġ= Ġ" mark logic / v 6 " ĊĊĠĠĠĠĠĠĠ ĠassertThat ( settings . product , Ġ` is `( Mark Logic . MARK LOGIC )) ĊĠĠĠĠĠĠĠ ĠassertThat ( settings . product Version , Ġ` is `( Mark Logic . VERSION _ 6 _ 0 )) ĊĊĠĠĠĠĠĠĠ Ġ// ĠSetting Ġvia Ġthe Ġtransient Ġproperties Ġupdates Ġthe Ġbean Ġproperties . ĊĠĠĠĠĠĠĠ ĠassertThat ( settings . implementation Version , Ġ` is ` (" mark logic / v 6 ")) ĊĠĠĠĠĠĠĠ ĠassertThat ( settings . X Query 1 0 Dialect , Ġ` is ` (" x query ")) ĊĠĠĠĠĠĠĠ ĠassertThat ( settings . X Query 3 0 Dialect , Ġ` is ` (" x query ")) ĊĠĠĠĠĠĠĠ ĠassertThat ( settings . X Query 3 1 Dialect , Ġ` is ` (" x query ")) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġ@ DisplayName (" unsupported Ġimplementation Ġversion ") ĊĠĠĠ Ġfun Ġtest Default X Query Dialect For Unsupported X Query Versions () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġsettings Ġ= ĠX Query Project Settings () ĊĠĠĠĠĠĠĠ Ġsettings . implementation Version Ġ= Ġ" mark logic / v 7 " ĊĠĠĠĠĠĠĠ Ġsettings . X Query 1 0 Dialect Ġ= Ġnull ĊĠĠĠĠĠĠĠ Ġsettings . X Query 3 0 Dialect Ġ= Ġnull ĊĠĠĠĠĠĠĠ Ġsettings . X Query 3 1 Dialect Ġ= Ġnull ĊĊĠĠĠĠĠĠĠ Ġsettings . implementation Version Ġ= Ġ" w 3 c / spec " ĊĠĠĠĠĠĠĠ Ġsettings . X Query 1 0 Dialect Ġ= Ġ" w 3 c / 1 . 0 " ĊĠĠĠĠĠĠĠ Ġsettings . X Query 3 0 Dialect Ġ= Ġ" w 3 c / 3 . 0 " ĊĠĠĠĠĠĠĠ Ġsettings . X Query 3 1 Dialect Ġ= Ġ" w 3 c / 3 . 1 " ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġ@ DisplayName (" serialization Ġto Ġxml ") ĊĠĠĠ Ġfun Ġtest Serialization () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġsettings Ġ= ĠX Query Project Settings () ĊĠĠĠĠĠĠĠ Ġval Ġoutput ter Ġ= ĠX M LO ut put ter () ĊĊĠĠĠĠĠĠĠ Ġval Ġexpected Ġ= ĠlistOf ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ"< X Query Project Settings >", ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ"< option Ġname =\" X Query 1 0 Dialect \" Ġvalue =\" x query \" Ġ/> ", ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ"< option Ġname =\" X Query 3 0 Dialect \" Ġvalue =\" x query \" Ġ/> ", ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ"< option Ġname =\" X Query 3 1 Dialect \" Ġvalue =\" x query \" Ġ/> ", ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ"< option Ġname =\" X Query Version \" Ġvalue =\" 1 . 0 \" Ġ/> ", ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ"< option Ġname =\" implementation Version \" Ġvalue =\" w 3 c / spec / v 1 ed \" Ġ/> ", ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ"</ X Query Project Settings >" ĊĠĠĠĠĠĠĠ Ġ). join ToString ("") ĊĠĠĠĠĠĠĠ Ġval Ġelement Ġ= ĠXml Serializer . serialize ( settings ) ĊĠĠĠĠĠĠĠ ĠassertThat ( output ter . output String ( element ), Ġ` is `( expected )) ĊĠĠĠ Ġ} Ċ } Ċ