package Ġcom . s ild ian . apps . to ge trail . trail . model . core Ċ Ċ import Ġandroid . os . Parcel Ċ import Ġcom . google . firebase . firestore . Geo Point Ċ import Ġcom . s ild ian . apps . to ge trail . location . model . core . Country Ċ import Ġcom . s ild ian . apps . to ge trail . location . model . core . Location Ċ import Ġcom . s ild ian . apps . to ge trail . location . model . core . Region Ċ import Ġorg . junit . Test Ċ Ċ import Ġorg . junit . Assert .* Ċ import Ġorg . junit . runner . RunWith Ċ import Ġorg . ro bo lectric . Ro bo lectric TestRunner Ċ import Ġorg . ro bo lectric . annotation . Config Ċ Ċ @ RunWith ( Ro bo lectric TestRunner :: class ) Ċ @ Config ( sdk Ġ= Ġ[ 2 8 ]) Ċ class ĠTr ail Test Ġ{ ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġgiven _ valid Trail _ when _ is Data Valid _ then _ check Result IsTrue (){ ĊĠĠĠĠĠĠĠ Ġval Ġtrail = Trail ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġname =" Super ĠTr ail ", ĊĠĠĠĠĠĠĠĠĠĠĠ Ġlocation Ġ= ĠLocation ( country Ġ= ĠCountry (" FR ", Ġ" Fr ance ")), ĊĠĠĠĠĠĠĠĠĠĠĠ Ġlevel = Trail Level . MEDIUM ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ ĠassertTrue ( trail . is Data Valid ()) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġgiven _ non Valid Trail _ when _ is Data Valid _ then _ check Result IsFalse (){ ĊĠĠĠĠĠĠĠ Ġval Ġtrail = Trail ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġname =" Super ĠTr ail " ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ ĠassertFalse ( trail . is Data Valid ()) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġgiven _ photos Urls _ when _ getAll Photos Urls _ then _ check Result Contains All Photos Urls () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġphoto 1 =" https :// photo 1 . png " ĊĠĠĠĠĠĠĠ Ġval Ġphoto 2 =" https :// photo 2 . png " ĊĠĠĠĠĠĠĠ Ġval Ġphoto 3 =" https :// photo 3 . png " ĊĠĠĠĠĠĠĠ Ġval Ġtrail = Trail ( main Photo Url Ġ= Ġphoto 1 ) ĊĠĠĠĠĠĠĠ Ġval Ġpo i 1 = Trail Point Of Interest ( photoUrl Ġ= Ġphoto 2 ) ĊĠĠĠĠĠĠĠ Ġval Ġpo i 2 = Trail Point Of Interest ( photoUrl Ġ= Ġphoto 3 ) ĊĠĠĠĠĠĠĠ Ġtrail . trail Track . trail Points Of Interest . addAll ( listOf ( poi 1 , Ġpo i 2 )) ĊĠĠĠĠĠĠĠ Ġval Ġphotos = trail . getAll Photos Urls () ĊĠĠĠĠĠĠĠ ĠassertEquals ( listOf ( photo 1 , Ġphoto 2 , Ġphoto 3 ), Ġphotos ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġgiven _ photos Urls To Trail And PO I _ when _ getFirst Photo Url _ then _ check Result Contains Trail Photo Url () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġphoto 1 =" https :// photo 1 . png " ĊĠĠĠĠĠĠĠ Ġval Ġphoto 2 =" https :// photo 2 . png " ĊĠĠĠĠĠĠĠ Ġval Ġphoto 3 =" https :// photo 3 . png " ĊĠĠĠĠĠĠĠ Ġval Ġtrail = Trail ( main Photo Url Ġ= Ġphoto 1 ) ĊĠĠĠĠĠĠĠ Ġval Ġpo i 1 = Trail Point Of Interest ( photoUrl Ġ= Ġphoto 2 ) ĊĠĠĠĠĠĠĠ Ġval Ġpo i 2 = Trail Point Of Interest ( photoUrl Ġ= Ġphoto 3 ) ĊĠĠĠĠĠĠĠ Ġtrail . trail Track . trail Points Of Interest . addAll ( listOf ( poi 1 , Ġpo i 2 )) ĊĠĠĠĠĠĠĠ Ġval Ġphoto = trail . getFirst Photo Url () ĊĠĠĠĠĠĠĠ ĠassertEquals ( photo 1 , Ġphoto ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġgiven _ photos Urls To Last PO I _ when _ getFirst Photo Url _ then _ check Result Contains Last PO IP h oto Url () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġphoto 1 =" https :// photo 1 . png " ĊĠĠĠĠĠĠĠ Ġval Ġtrail = Trail () ĊĠĠĠĠĠĠĠ Ġval Ġpo i 1 = Trail Point Of Interest () ĊĠĠĠĠĠĠĠ Ġval Ġpo i 2 = Trail Point Of Interest ( photoUrl Ġ= Ġphoto 1 ) ĊĠĠĠĠĠĠĠ Ġtrail . trail Track . trail Points Of Interest . addAll ( listOf ( poi 1 , Ġpo i 2 )) ĊĠĠĠĠĠĠĠ Ġval Ġphoto = trail . getFirst Photo Url () ĊĠĠĠĠĠĠĠ ĠassertEquals ( photo 1 , Ġphoto ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġgiven _ trail _ when _ createFrom Parcel _ then _ check Result Is Equal (){ ĊĠĠĠĠĠĠĠ Ġval Ġparcel = ĠParcel . obtain () ĊĠĠĠĠĠĠĠ Ġval Ġtrail 1 = Trail ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġid =" Trail 1 ", ĊĠĠĠĠĠĠĠĠĠĠĠ Ġname =" Super ĠTr ail ", ĊĠĠĠĠĠĠĠĠĠĠĠ Ġsource =" To ge Trail ", ĊĠĠĠĠĠĠĠĠĠĠĠ Ġposition = ĠGeo Point ( 5 0 . 0 , Ġ 5 0 . 0 ), ĊĠĠĠĠĠĠĠĠĠĠĠ Ġlocation = ĠLocation ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠCountry (" TO L ", Ġ" Tot ol and "), ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠRegion (" TOR ", Ġ" Tot ore g ion "), ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ" T oto ĠCity " ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ), ĊĠĠĠĠĠĠĠĠĠĠĠ Ġduration = 6 0 , ĊĠĠĠĠĠĠĠĠĠĠĠ Ġdistance = 1 0 0 0 , ĊĠĠĠĠĠĠĠĠĠĠĠ Ġas cent = 5 0 0 , ĊĠĠĠĠĠĠĠĠĠĠĠ Ġdesc ent = 3 0 0 , ĊĠĠĠĠĠĠĠĠĠĠĠ Ġmax Elevation Ġ= Ġ 1 5 0 0 , ĊĠĠĠĠĠĠĠĠĠĠĠ Ġmin Elevation Ġ= Ġ 1 1 0 0 , ĊĠĠĠĠĠĠĠĠĠĠĠ Ġauthor Id Ġ= Ġ" H iker 1 " ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ Ġtrail 1 . writeTo Parcel ( parcel , Ġtrail 1 . describe Contents ()) ĊĠĠĠĠĠĠĠ Ġparcel . setData Position ( 0 ) ĊĊĠĠĠĠĠĠĠ Ġval Ġtrail 2 = Trail . create ( parcel ) ĊĊĠĠĠĠĠĠĠ ĠassertEquals ( trail 1 , Ġtrail 2 ) ĊĠĠĠ Ġ} Ċ }