/* ĠCopyright Ġ 2 0 2 1 ĠBetter ĠLtd Ġ( www . better . care ) Ċ Ġ* Ċ Ġ* Ġ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 Ġcare . better . platform . web . template Ċ Ċ import Ġcare . better . platform . web . template . ab straction . Abstract Web Template Test Ċ import Ġcare . better . platform . web . template . builder . context . Web Template Builder Context Ċ import Ġcare . better . platform . web . template . builder . exception . Unknown Path Builder Exception Ċ import Ġcare . better . platform . web . template . builder . model . Web Template Node Ċ import Ġcare . better . platform . web . template . builder . Web Template Builder Ċ import Ġorg . assertj . core . api . Assertions . assertThat Ċ import Ġorg . assertj . core . api . Assertions . assertThat Thrown By Ċ import Ġorg . junit . jupiter . api . Test Ċ import Ġjava . io . IOException Ċ import Ġjavax . xml . bind . JAXB Exception Ċ Ċ /** Ċ Ġ* Ġ@ author ĠPri moz ĠDe lop st Ċ Ġ* Ġ@ since Ġ 3 . 1 . 0 Ċ Ġ*/ Ċ class ĠFind Node Test Ġ: ĠAbstract Web Template Test () Ġ{ ĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġ@ Throws ( JAXB Exception :: class , ĠIOException :: class ) ĊĠĠĠ Ġfun Ġtest C da Document () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġtemplate Name Ġ= Ġ"/ CD A ĠDocument . opt " ĊĠĠĠĠĠĠĠ Ġval Ġweb Template Ġ= ĠWeb Template Builder . build NonNull ( get Template ( template Name ), ĠWeb Template Builder Context (" sl ")) ĊĠĠĠĠĠĠĠ ĠassertThat ( web Template . find Web Template Node (" cda _ document / cda _ component : 0 ")). isNotNull ĊĠĠĠĠĠĠĠ ĠassertThat ( web Template . find Web Template Node (" cda _ document / cda _ component : 1 9 9 ")). isNotNull ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġ@ Throws ( JAXB Exception :: class , ĠIOException :: class ) ĊĠĠĠ Ġfun Ġtest Find Node By A ql Path () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġtemplate Ġ= Ġget Template ("/ Dog AP Trace - annot . opt ") ĊĠĠĠĠĠĠĠ ĠassertThat ( template ). isNotNull ĊĠĠĠĠĠĠĠ Ġval Ġweb Template Ġ= ĠWeb Template Builder . build NonNull ( template , ĠWeb Template Builder Context (" en ")) ĊĠĠĠĠĠĠĠ ĠassertThat ( web Template ). isNotNull ĊĠĠĠĠĠĠĠ Ġval Ġfirst Node : ĠWeb Template Node Ġ= Ġweb Template . find Web Template Node By A ql Path ("/ content [ open E HR - E HR - OB SERV ATION . ap _ clamp . v 9 ]/ data [ at 0 0 0 1 ]/ events [ at 0 0 0 2 ]/ data [ at 0 0 0 3 ]/ items [ at 0 0 0 4 ]/ value ") ĊĠĠĠĠĠĠĠ ĠassertThat ( first Node ). isNotNull ĊĠĠĠĠĠĠĠ ĠassertThat ( first Node . nodeId ). isEqualTo (" at 0 0 0 4 ") ĊĠĠĠĠĠĠĠ ĠassertThat ( first Node . json Id ). isEqualTo (" action _ potential ") ĊĠĠĠĠĠĠĠ ĠassertThat ( first Node . rm Type ). isEqualTo (" DV _ QU ANT ITY ") ĊĠĠĠĠĠĠĠ Ġval Ġsecond Node : ĠWeb Template Node Ġ= Ġweb Template . find Web Template Node By A ql Path ("/ content [ open E HR - E HR - OB SERV ATION . ap _ clamp . v 9 ]/ data [ at 0 0 0 1 ]/ events [ at 0 0 0 2 ]/ data [ at 0 0 0 3 ]/ items [ at 0 0 0 4 ]") ĊĠĠĠĠĠĠĠ ĠassertThat ( second Node ). isNotNull ĊĠĠĠĠĠĠĠ ĠassertThat ( second Node . nodeId ). isEqualTo ( first Node . nodeId ) ĊĠĠĠĠĠĠĠ ĠassertThat ( second Node . json Id ). isEqualTo ( first Node . json Id ) ĊĠĠĠĠĠĠĠ ĠassertThat ( second Node . rm Type ). isEqualTo ( first Node . rm Type ) ĊĠĠĠĠĠĠĠ ĠassertThat Thrown By Ġ{ Ġweb Template . find Web Template Node By A ql Path ("/ content [ open E HR - E HR - OB SERV ATION . ap _ clamp . v 9 ]/ data [ at 0 0 0 1 ]/ events [ at 0 0 0 2 ]/ data [ at 0 0 0 3 ]/ items [ at 1 0 0 4 ]") Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. isInstanceOf ( Unknown Path Builder Exception :: class . java ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġ@ Throws ( JAXB Exception :: class , ĠIOException :: class ) ĊĠĠĠ Ġfun Ġtest Find Node ById () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġtemplate Ġ= Ġget Template ("/ Dog AP Trace - annot . opt ") ĊĠĠĠĠĠĠĠ Ġval Ġweb Template Ġ= ĠWeb Template Builder . build NonNull ( template , ĠWeb Template Builder Context (" en ")) ĊĠĠĠĠĠĠĠ Ġval Ġweb Template Node : ĠWeb Template Node Ġ= Ġweb Template . find Web Template Node (" experiment / ap _ clamp / any _ event / measurement _ time ") ĊĠĠĠĠĠĠĠ ĠassertThat ( web Template Node ). isNotNull ĊĠĠĠĠĠĠĠ ĠassertThat ( web Template Node . nodeId ). isEqualTo (" at 0 0 0 5 ") ĊĠĠĠĠĠĠĠ ĠassertThat ( web Template Node . json Id ). isEqualTo (" measurement _ time ") ĊĠĠĠĠĠĠĠ ĠassertThat ( web Template Node . rm Type ). isEqualTo (" DV _ QU ANT ITY ") ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġ@ Throws ( JAXB Exception :: class , ĠIOException :: class ) ĊĠĠĠ Ġfun Ġtest Find Node By A ql Path Relative () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġtemplate Ġ= Ġget Template ("/ V ital ĠSign s . xml ") ĊĠĠĠĠĠĠĠ Ġval Ġweb Template Ġ= ĠWeb Template Builder . build NonNull ( template , ĠWeb Template Builder Context (" en ")) ĊĠĠĠĠĠĠĠ Ġval Ġhits : ĠList < Web Template Node > Ġ= Ġweb Template . find Web Template Nodes By A ql Path ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ" open E HR - E HR - OB SERV ATION . blood _ pressure . v 1 ", ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ"/ data [ at 0 0 0 1 ]/ events [ at 0 0 0 6 ]/ data [ at 0 0 0 3 ]/ items [ at 0 0 0 4 ]/ value ") ĊĠĠĠĠĠĠĠ ĠassertThat ( hits ). has Size ( 1 ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġ@ Throws ( JAXB Exception :: class , ĠIOException :: class ) ĊĠĠĠ Ġfun Ġtest Find Node ById Non Existing () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġtemplate Ġ= Ġget Template ("/ Dog AP Trace - annot . opt ") ĊĠĠĠĠĠĠĠ Ġval Ġweb Template Ġ= ĠWeb Template Builder . build NonNull ( template , ĠWeb Template Builder Context (" en ")) ĊĠĠĠĠĠĠĠ ĠassertThat Thrown By Ġ{ Ġweb Template . find Web Template Node (" experiment / ap _ clamp / any _ event / non _ existing ") Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. isInstanceOf ( Unknown Path Builder Exception :: class . java ) ĊĠĠĠ Ġ} Ċ } Ċ