/* Ċ Ġ* Ġ ĠCopyright Ġ( c ) Ġ 2 0 0 4 - 2 0 2 1 , ĠUniversity Ġof ĠOs lo Ċ Ġ* Ġ ĠAll Ġrights Ġreserved . Ċ Ġ* Ċ Ġ* Ġ ĠRedistribution Ġand Ġuse Ġin Ġsource Ġand Ġbinary Ġforms , Ġwith Ġor Ġwithout Ċ Ġ* Ġ Ġmodification , Ġare Ġpermitted Ġprovided Ġthat Ġthe Ġfollowing Ġconditions Ġare Ġmet : Ċ Ġ* Ġ ĠRedistributions Ġof Ġsource Ġcode Ġmust Ġretain Ġthe Ġabove Ġcopyright Ġnotice , Ġthis Ċ Ġ* Ġ Ġlist Ġof Ġconditions Ġand Ġthe Ġfollowing Ġdisclaimer . Ċ Ġ* Ċ Ġ* Ġ ĠRedistributions Ġin Ġbinary Ġform Ġmust Ġreproduce Ġthe Ġabove Ġcopyright Ġnotice , Ċ Ġ* Ġ Ġthis Ġlist Ġof Ġconditions Ġand Ġthe Ġfollowing Ġdisclaimer Ġin Ġthe Ġdocumentation Ċ Ġ* Ġ Ġand / or Ġother Ġmaterials Ġprovided Ġwith Ġthe Ġdistribution . Ċ Ġ* Ġ ĠNeither Ġthe Ġname Ġof Ġthe ĠH ISP Ġproject Ġnor Ġthe Ġnames Ġof Ġits Ġcontributors Ġmay Ċ Ġ* Ġ Ġbe Ġused Ġto Ġendorse Ġor Ġpromote Ġproducts Ġderived Ġfrom Ġthis Ġsoftware Ġwithout Ċ Ġ* Ġ Ġspecific Ġprior Ġwritten Ġpermission . Ċ Ġ* Ċ Ġ* Ġ ĠTHIS ĠSOFTWARE ĠIS ĠPROVIDED ĠBY ĠTHE ĠCOPYRIGHT ĠHOLDERS ĠAND ĠCONTRIBUTORS Ġ" AS ĠIS " ĠAND Ċ Ġ* Ġ ĠANY ĠEXPRESS ĠOR ĠIMPLIED ĠWARRANTIES , ĠINCLUDING , ĠBUT ĠNOT ĠLIMITED ĠTO , ĠTHE ĠIMPLIED Ċ Ġ* Ġ ĠWARRANTIES ĠOF ĠMERCHANTABILITY ĠAND ĠFITNESS ĠFOR ĠA ĠPARTICULAR ĠPURPOSE ĠARE Ċ Ġ* Ġ ĠDISCLAIMED . ĠIN ĠNO ĠEVENT ĠSHALL ĠTHE ĠCOPYRIGHT ĠOWNER ĠOR ĠCONTRIBUTORS ĠBE ĠLIABLE ĠFOR Ċ Ġ* Ġ ĠANY ĠDIRECT , ĠINDIRECT , ĠINCIDENTAL , ĠSPECIAL , ĠEXEMPLARY , ĠOR ĠCONSEQUENTIAL ĠDAMAGES Ċ Ġ* Ġ Ġ( INCLUDING , ĠBUT ĠNOT ĠLIMITED ĠTO , ĠPROCUREMENT ĠOF ĠSUBSTITUTE ĠGOODS ĠOR ĠSERVICES ; Ċ Ġ* Ġ ĠLOSS ĠOF ĠUSE , ĠDATA , ĠOR ĠPROFITS ; ĠOR ĠBUSINESS ĠINTERRUPTION ) ĠHOWEVER ĠCAUSED ĠAND ĠON Ċ Ġ* Ġ ĠANY ĠTHEORY ĠOF ĠLIABILITY , ĠWHETHER ĠIN ĠCONTRACT , ĠSTRICT ĠLIABILITY , ĠOR ĠTORT Ċ Ġ* Ġ Ġ( INCLUDING ĠNEGLIGENCE ĠOR ĠOTHERWISE ) ĠARISING ĠIN ĠANY ĠWAY ĠOUT ĠOF ĠTHE ĠUSE ĠOF ĠTHIS Ċ Ġ* Ġ ĠSOFTWARE , ĠEVEN ĠIF ĠADVISED ĠOF ĠTHE ĠPOSSIBILITY ĠOF ĠSUCH ĠDAMAGE . Ċ Ġ*/ Ċ package Ġorg . h isp . dh is . android . core . tracked entity . internal Ċ Ċ import Ġcom . google . common . collect . Lists Ċ import Ġcom . google . common . truth . Truth . assertThat Ċ import Ġorg . h isp . dh is . android . core . arch . helpers . U ids Helper . get U ids List Ċ import Ġorg . h isp . dh is . android . core . common . State Ċ import Ġorg . h isp . dh is . android . core . maintenance . D 2 Error Ċ import Ġorg . h isp . dh is . android . core . note . Note Ċ import Ġorg . h isp . dh is . android . core . note . Note Create Projection Ċ import Ġorg . h isp . dh is . android . core . tracked entity . Tracked Entity Instance Ċ import Ġorg . h isp . dh is . android . core . utils . runner . D 2 J unit Runner Ċ import Ġorg . junit . Test Ċ import Ġorg . junit . runner . RunWith Ċ Ċ @ RunWith ( D 2 J unit Runner :: class ) Ċ class ĠTrack ed Entity Instance Post Payload Generator 2 9 Mock Integration Should Ġ: ĠBase Payload Generator Mock Integration () Ġ{ ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġbuild _ payload _ with _ different _ enroll ments () Ġ{ ĊĠĠĠĠĠĠĠ Ġstore Tracker Data () ĊĊĠĠĠĠĠĠĠ Ġval Ġpartitions Ġ= Ġpartitions ĊĊĠĠĠĠĠĠĠ ĠassertThat ( partitions . size ). isEqualTo ( 1 ) ĊĠĠĠĠĠĠĠ ĠassertThat ( partitions . first (). size ). isEqualTo ( 1 ) ĊĊĠĠĠĠĠĠĠ Ġfor Ġ( instance Ġin Ġpartitions . first ()) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertThat ( get En roll ments ( instance ). size ). isEqualTo ( 2 ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġfor Ġ( enrollment Ġin Ġget En roll ments ( instance )) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠassertThat ( get Events ( enrollment ). size ). isEqualTo ( 1 ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġfor Ġ( event Ġin Ġget Events ( enrollment )) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠassertThat ( event . tracked Entity Data Values () !!. size ). isEqualTo ( 1 ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġval Ġpartitions : ĠList < List < Tracked Entity Instance >> ĊĠĠĠĠĠĠĠ Ġget () Ġ= Ġpayload Generator 2 9 . get Tracked Entity Instances Partitions 2 9 ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġte i Store . query Tracked Entity Instances To Sync () ĊĠĠĠĠĠĠĠ Ġ) ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġbuild _ payload _ without _ events _ marked _ as _ error () Ġ{ ĊĠĠĠĠĠĠĠ Ġstore Tracker Data () ĊĊĠĠĠĠĠĠĠ Ġenrollment Store . set Ag gregated Sync State ( enrollment 3 Id , ĠState . TO _ POST ) ĊĊĠĠĠĠĠĠĠ Ġval Ġpartitions Ġ= Ġpartitions ĊĊĠĠĠĠĠĠĠ ĠassertThat ( partitions . size ). isEqualTo ( 1 ) ĊĠĠĠĠĠĠĠ ĠassertThat ( partitions . first (). size ). isEqualTo ( 1 ) ĊĊĠĠĠĠĠĠĠ Ġfor Ġ( instance Ġin Ġpartitions . first ()) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertThat ( get En roll ments ( instance ). size ). isEqualTo ( 3 ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġfor Ġ( enrollment Ġin Ġget En roll ments ( instance )) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġif Ġ( enrollment . uid () Ġ== Ġenrollment 3 Id ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠassertThat ( get Events ( enrollment ). size ). isEqualTo ( 0 ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ} Ġelse Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠassertThat ( get Events ( enrollment ). size ). isEqualTo ( 1 ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġhandle _ import _ conflict s _ correct ly () Ġ{ ĊĠĠĠĠĠĠĠ Ġstore Tracker Data () ĊĊĠĠĠĠĠĠĠ Ġd his 2 Mock Server . enqueue Mock Response (" imports / web _ response _ with _ import _ conflict s _ 2 . json ") ĊĊĠĠĠĠĠĠĠ Ġd 2 . tracked Entity Module (). tracked Entity Instances (). blocking Upload () ĊĊĠĠĠĠĠĠĠ ĠassertThat ( d 2 . import Module (). tracker Import Conflict s (). blocking Count ()). isEqualTo ( 3 ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġdelete _ old _ import _ conflict s () Ġ{ ĊĠĠĠĠĠĠĠ Ġstore Tracker Data () ĊĊĠĠĠĠĠĠĠ Ġd his 2 Mock Server . enqueue Mock Response (" imports / web _ response _ with _ import _ conflict s _ 2 . json ") ĊĊĠĠĠĠĠĠĠ Ġd 2 . tracked Entity Module (). tracked Entity Instances (). blocking Upload () ĊĊĠĠĠĠĠĠĠ ĠassertThat ( d 2 . import Module (). tracker Import Conflict s (). blocking Count ()). isEqualTo ( 3 ) ĊĊĠĠĠĠĠĠĠ Ġte i Store . set Ag gregated Sync State (" te i Id ", ĠState . TO _ POST ) ĊĠĠĠĠĠĠĠ Ġenrollment Store . set Ag gregated Sync State (" enrollment 1 Id ", ĠState . TO _ POST ) ĊĠĠĠĠĠĠĠ Ġenrollment Store . set Ag gregated Sync State (" enrollment 2 Id ", ĠState . TO _ POST ) ĊĠĠĠĠĠĠĠ Ġevent Store . set Sync State Or Delete (" event 1 Id ", ĠState . TO _ POST ) ĊĠĠĠĠĠĠĠ Ġevent Store . set Sync State Or Delete (" event 2 Id ", ĠState . TO _ POST ) ĊĊĠĠĠĠĠĠĠ Ġd his 2 Mock Server . enqueue Mock Response (" imports / web _ response _ with _ import _ conflict s _ 3 . json ") ĊĊĠĠĠĠĠĠĠ Ġd 2 . tracked Entity Module (). tracked Entity Instances (). blocking Upload () ĊĠĠĠĠĠĠĠ ĠassertThat ( d 2 . import Module (). tracker Import Conflict s (). blocking Count ()). isEqualTo ( 1 ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġ@ Throws ( D 2 Error :: class ) ĊĠĠĠ Ġfun Ġhandle _ te i _ de letions () Ġ{ ĊĠĠĠĠĠĠĠ Ġstore Tracker Data () ĊĊĠĠĠĠĠĠĠ Ġd 2 . tracked Entity Module (). tracked Entity Instances (). uid (" te i Id "). blocking Delete () ĊĊĠĠĠĠĠĠĠ Ġ// ĠThere Ġis Ġno ĠTE Is Ġto Ġupload , Ġso Ġthere Ġis Ġno Ġrequest Ġto Ġenqueue . ĊĠĠĠĠĠĠĠ Ġd 2 . tracked Entity Module (). tracked Entity Instances (). blocking Upload () ĊĠĠĠĠĠĠĠ ĠassertThat ( d 2 . tracked Entity Module (). tracked Entity Instances (). blocking Count ()). isEqualTo ( 0 ) ĊĠĠĠĠĠĠĠ ĠassertThat ( d 2 . enrollment Module (). enroll ments (). blocking Count ()). isEqualTo ( 0 ) ĊĠĠĠĠĠĠĠ ĠassertThat ( d 2 . event Module (). events (). by Enrollment Uid (). isNotNull . blocking Count ()). isEqualTo ( 0 ) ĊĠĠĠĠĠĠĠ ĠassertThat ( d 2 . import Module (). tracker Import Conflict s (). blocking Count ()). isEqualTo ( 0 ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġ@ Throws ( Exception :: class ) ĊĠĠĠ Ġfun Ġrecreate _ te is _ with _ filters _ and _ relationships () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġte i 1 Ġ= Ġ" te i 1 " ĊĠĠĠĠĠĠĠ Ġval Ġte i 2 Ġ= Ġ" te i 2 " ĊĠĠĠĠĠĠĠ Ġval Ġte i 3 Ġ= Ġ" te i 3 " ĊĠĠĠĠĠĠĠ Ġval Ġte i 4 Ġ= Ġ" te i 4 " ĊĠĠĠĠĠĠĠ Ġval Ġte i 5 Ġ= Ġ" te i 5 " ĊĊĠĠĠĠĠĠĠ Ġstore Simple Tracked Entity Instance ( te i 1 , ĠState . TO _ POST ) ĊĠĠĠĠĠĠĠ Ġstore Simple Tracked Entity Instance ( te i 2 , ĠState . TO _ POST ) ĊĠĠĠĠĠĠĠ Ġstore Simple Tracked Entity Instance ( te i 3 , ĠState . TO _ POST ) ĊĠĠĠĠĠĠĠ Ġstore Simple Tracked Entity Instance ( te i 4 , ĠState . TO _ POST ) ĊĠĠĠĠĠĠĠ Ġstore Simple Tracked Entity Instance ( te i 5 , ĠState . SYNC ED ) ĊĊĠĠĠĠĠĠĠ Ġstore Relationship (" relationship 1 ", Ġte i 1 , Ġte i 2 ) ĊĠĠĠĠĠĠĠ Ġstore Relationship (" relationship 2 ", Ġte i 2 , Ġte i 3 ) ĊĠĠĠĠĠĠĠ Ġstore Relationship (" relationship 3 ", Ġte i 1 , Ġte i 5 ) ĊĠĠĠĠĠĠĠ Ġstore Relationship (" relationship 4 ", Ġte i 5 , Ġte i 4 ) ĊĊĠĠĠĠĠĠĠ Ġval Ġpartitions Ġ= Ġpayload Generator 2 9 . get Tracked Entity Instances Partitions 2 9 ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġd 2 . tracked Entity Module (). tracked Entity Instances (). by Uid (). eq ( te i 1 ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. by Ag gregated Sync State (). ` in ` (* State . upload able States ()). blocking Get () ĊĠĠĠĠĠĠĠ Ġ) ĊĊĠĠĠĠĠĠĠ ĠassertThat ( partitions . size ). isEqualTo ( 1 ) ĊĠĠĠĠĠĠĠ ĠassertThat ( partitions [ 0 ]. size ). isEqualTo ( 3 ) ĊĠĠĠĠĠĠĠ ĠassertThat ( get U ids List ( partitions [ 0 ]). contains All ( Lists . newArrayList ( te i 1 , Ġte i 2 , Ġte i 3 ))). isTrue () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġrestore _ payload _ states _ when _ error _ 5 0 0 () Ġ{ ĊĠĠĠĠĠĠĠ Ġstore Tracker Data () ĊĊĠĠĠĠĠĠĠ Ġd his 2 Mock Server . enqueue Mock Response ( 5 0 0 , Ġ" Internal ĠServer ĠError ") ĊĠĠĠĠĠĠĠ Ġd 2 . tracked Entity Module (). tracked Entity Instances (). blocking Upload () ĊĊĠĠĠĠĠĠĠ Ġval Ġinstance Ġ= Ġte i Store . select First () ĊĠĠĠĠĠĠĠ ĠassertThat ( instance !!. sync State ()). isEqualTo ( State . TO _ POST ) ĊĊĠĠĠĠĠĠĠ Ġval Ġen roll ments Ġ= Ġenrollment Store . selectAll () ĊĠĠĠĠĠĠĠ Ġfor Ġ( enrollment Ġin Ġen roll ments ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġif Ġ( enrollment 1 Id Ġ== Ġenrollment . uid () Ġ|| Ġenrollment 2 Id Ġ== Ġenrollment . uid ()) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠassertThat ( enrollment . sync State ()). isEqualTo ( State . TO _ POST ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠ Ġval Ġevents Ġ= Ġevent Store . selectAll () ĊĠĠĠĠĠĠĠ Ġfor Ġ( event Ġin Ġevents ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġif Ġ( event 1 Id Ġ== Ġevent . uid ()) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠassertThat ( event . sync State ()). isEqualTo ( State . TO _ UPDATE ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠ Ġif Ġ( event 2 Id Ġ== Ġevent . uid ()) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠassertThat ( event . sync State ()). isEqualTo ( State . SYNC ED _ V IA _ SMS ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġ@ Throws ( D 2 Error :: class ) ĊĠĠĠ Ġfun Ġbuild _ payload _ with _ enrollment _ notes () Ġ{ ĊĠĠĠĠĠĠĠ Ġstore Tracker Data () ĊĠĠĠĠĠĠĠ Ġd 2 . note Module (). notes (). blocking Add ( ĊĠĠĠĠĠĠĠĠĠĠĠ ĠNote Create Projection . builder () ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. enrollment ( enrollment 1 Id ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. note Type ( Note . Note Type . EN ROLL MENT _ NOTE ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. value (" This Ġis Ġan Ġenrollment Ġnote ") ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. build () ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ Ġval Ġpartitions Ġ= Ġpartitions ĊĠĠĠĠĠĠĠ ĠassertThat ( partitions . size ). isEqualTo ( 1 ) ĊĠĠĠĠĠĠĠ ĠassertThat ( partitions . first (). size ). isEqualTo ( 1 ) ĊĠĠĠĠĠĠĠ Ġfor Ġ( instance Ġin Ġpartitions . first ()) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġfor Ġ( enrollment Ġin Ġget En roll ments ( instance )) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġif Ġ( enrollment . uid () Ġ== Ġenrollment 1 Id ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠassertThat ( enrollment . notes () !!. size ). isEqualTo ( 1 ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ} Ġelse Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠassertThat ( enrollment . notes () !!. size ). isEqualTo ( 0 ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġ@ Throws ( D 2 Error :: class ) ĊĠĠĠ Ġfun Ġbuild _ payload _ with _ event _ notes () Ġ{ ĊĠĠĠĠĠĠĠ Ġstore Tracker Data () ĊĊĠĠĠĠĠĠĠ Ġd 2 . note Module (). notes (). blocking Add ( ĊĠĠĠĠĠĠĠĠĠĠĠ ĠNote Create Projection . builder () ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. event ( event 1 Id ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. note Type ( Note . Note Type . EVENT _ NOTE ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. value (" This Ġis Ġan Ġevent Ġnote ") ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. build () ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ Ġval Ġpartitions Ġ= Ġpartitions ĊĊĠĠĠĠĠĠĠ ĠassertThat ( partitions . size ). isEqualTo ( 1 ) ĊĠĠĠĠĠĠĠ ĠassertThat ( partitions . first (). size ). isEqualTo ( 1 ) ĊĠĠĠĠĠĠĠ Ġfor Ġ( instance Ġin Ġpartitions . first ()) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġfor Ġ( enrollment Ġin Ġget En roll ments ( instance )) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġif Ġ( enrollment . uid () Ġ== Ġenrollment 1 Id ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġfor Ġ( event Ġin Ġget Events ( enrollment )) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġif Ġ( event . uid () Ġ== Ġevent 1 Id ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠassertThat ( event . notes () !!. size ). isEqualTo ( 1 ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ} Ġelse Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠassertThat ( enrollment . notes () !!. size ). isEqualTo ( 0 ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġdo _ not _ ignore _ elements _ not _ present _ in _ the _ import _ summary () Ġ{ ĊĠĠĠĠĠĠĠ Ġstore Tracker Data () ĊĊĠĠĠĠĠĠĠ Ġ// ĠOnly Ġenrollment 1 Ġand Ġevent 1 Ġare ĠTO _ UPDATE ĊĠĠĠĠĠĠĠ Ġenrollment Store . set Ag gregated Sync State ( enrollment 2 Id , ĠState . SYNC ED ) ĊĠĠĠĠĠĠĠ Ġenrollment Store . set Sync State ( enrollment 2 Id , ĠState . SYNC ED ) ĊĠĠĠĠĠĠĠ Ġevent Store . set Ag gregated Sync State ( event 2 Id , ĠState . SYNC ED ) ĊĠĠĠĠĠĠĠ Ġevent Store . set Sync State ( event 2 Id , ĠState . SYNC ED ) ĊĊĠĠĠĠĠĠĠ Ġd his 2 Mock Server . enqueue Mock Response (" imports / web _ response _ with _ empty _ events . json ") ĊĠĠĠĠĠĠĠ Ġd 2 . tracked Entity Module (). tracked Entity Instances (). blocking Upload () ĊĊĠĠĠĠĠĠĠ Ġval Ġtracked Entity Instance Ġ= Ġte i Store . select By Uid ( te i Id ) ĊĠĠĠĠĠĠĠ ĠassertThat ( tracked Entity Instance !!. sync State ()). isEqualTo ( State . SYNC ED ) ĊĠĠĠĠĠĠĠ ĠassertThat ( tracked Entity Instance . ag gregated Sync State ()). isEqualTo ( State . TO _ UPDATE ) ĊĊĠĠĠĠĠĠĠ ĠassertThat ( enrollment Store . select By Uid ( enrollment 1 Id ) !!. sync State ()). isEqualTo ( State . SYNC ED ) ĊĠĠĠĠĠĠĠ ĠassertThat ( enrollment Store . select By Uid ( enrollment 1 Id ) !!. ag gregated Sync State ()). isEqualTo ( State . TO _ UPDATE ) ĊĠĠĠĠĠĠĠ ĠassertThat ( enrollment Store . select By Uid ( enrollment 2 Id ) !!. sync State ()). isEqualTo ( State . SYNC ED ) ĊĠĠĠĠĠĠĠ ĠassertThat ( enrollment Store . select By Uid ( enrollment 2 Id ) !!. ag gregated Sync State ()). isEqualTo ( State . SYNC ED ) ĊĊĠĠĠĠĠĠĠ ĠassertThat ( event Store . select By Uid ( event 1 Id ) !!. sync State ()). isEqualTo ( State . TO _ UPDATE ) ĊĠĠĠĠĠĠĠ ĠassertThat ( event Store . select By Uid ( event 2 Id ) !!. sync State ()). isEqualTo ( State . SYNC ED ) ĊĠĠĠ Ġ} Ċ } Ċ