/* Ċ Ġ* ĠCopyright Ġ( C ) Ġ 2 0 1 6 - 2 0 2 1 ĠHERE ĠEurope ĠB . V . Ċ Ġ* Ċ Ġ* Ġ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 . Ċ Ġ* Ċ Ġ* ĠSPDX - License - Identifier : ĠApache - 2 . 0 Ċ Ġ* ĠLicense - Filename : ĠLICENSE Ċ Ġ*/ Ċ Ċ package Ġcom . here . glue co di um . generator . dart Ċ Ċ import Ġcom . here . glue co di um . model . lime . L ime Element Ċ import Ġcom . here . glue co di um . model . lime . L ime Field Constructor Ċ import Ġcom . here . glue co di um . model . lime . L ime Function Ċ import Ġcom . here . glue co di um . model . lime . L ime Lazy Type Ref Ċ import Ġcom . here . glue co di um . model . lime . L ime Path . Companion . EMPTY _ PATH Ċ import Ġcom . here . glue co di um . model . lime . L ime Struct Ċ import Ġio . mock k . Mock K Annotations Ċ import Ġio . mock k . every Ċ import Ġio . mock k . impl . annotations . Mock K Ċ import Ġio . mock k . mock k Ċ import Ġorg . junit . Assert . assertFalse Ċ import Ġorg . junit . Assert . assertTrue Ċ import Ġorg . junit . Before Ċ import Ġorg . junit . Test Ċ import Ġorg . junit . runner . RunWith Ċ import Ġorg . junit . runners . JUnit 4 Ċ Ċ @ RunWith ( JUnit 4 :: class ) Ċ class ĠDart Over loads Validator Field Construct ors Test Ġ{ ĊĊĠĠĠ Ġprivate Ġval Ġall Elements Ġ= Ġmutable Map Of < String , ĠL ime Element >() ĊĠĠĠ Ġprivate Ġval Ġfc 1 Ġ= ĠL ime Field Constructor ( EMPTY _ PATH , Ġstruct Ref Ġ= ĠL ime Lazy Type Ref ("", Ġall Elements )) ĊĠĠĠ Ġprivate Ġval Ġfc 2 Ġ= ĠL ime Field Constructor ( EMPTY _ PATH , Ġstruct Ref Ġ= ĠL ime Lazy Type Ref ("", Ġall Elements )) ĊĠĠĠ Ġprivate Ġval Ġconstructor Ġ= ĠL ime Function ( EMPTY _ PATH , Ġis Constructor Ġ= Ġtrue ) ĊĠĠĠ Ġprivate Ġval Ġlime Struct Ġ= ĊĠĠĠĠĠĠĠ ĠL ime Struct ( EMPTY _ PATH , Ġfunctions Ġ= ĠlistOf ( constructor ), Ġfield Construct ors Ġ= ĠlistOf ( fc 1 , Ġfc 2 )) ĊĊĠĠĠ Ġ@ Mock K Ġprivate Ġlateinit Ġvar Ġname Resolver : ĠDart Name Resolver ĊĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġvalidator : ĠDart Over loads Validator ĊĊĠĠĠ Ġ@ Before ĊĠĠĠ Ġfun ĠsetUp () Ġ{ ĊĠĠĠĠĠĠĠ ĠMock K Annotations . init ( this , Ġrelax ed Ġ= Ġtrue ) ĊĠĠĠĠĠĠĠ Ġvalidator Ġ= ĠDart Over loads Validator ( name Resolver , Ġmock k ( relax ed Ġ= Ġtrue ), Ġtrue ) ĊĠĠĠĠĠĠĠ Ġall Elements [ "" ] Ġ= Ġlime Struct ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġvalidate Two Field Construct ors Valid () Ġ{ ĊĠĠĠĠĠĠĠ Ġevery Ġ{ Ġname Resolver . resolve Name ( fc 1 ) Ġ} Ġreturns Ġ" foo " ĊĠĠĠĠĠĠĠ Ġevery Ġ{ Ġname Resolver . resolve Name ( fc 2 ) Ġ} Ġreturns Ġ" bar " ĊĊĠĠĠĠĠĠĠ Ġval Ġresult Ġ= Ġvalidator . validate ( all Elements . values ) ĊĊĠĠĠĠĠĠĠ ĠassertTrue ( result ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġvalidate Two Field Construct ors Invalid () Ġ{ ĊĠĠĠĠĠĠĠ Ġevery Ġ{ Ġname Resolver . resolve Name ( fc 1 ) Ġ} Ġreturns Ġ" foo " ĊĠĠĠĠĠĠĠ Ġevery Ġ{ Ġname Resolver . resolve Name ( fc 2 ) Ġ} Ġreturns Ġ" foo " ĊĊĠĠĠĠĠĠĠ Ġval Ġresult Ġ= Ġvalidator . validate ( all Elements . values ) ĊĊĠĠĠĠĠĠĠ ĠassertFalse ( result ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġvalidate Field Custom Construct ors Valid () Ġ{ ĊĠĠĠĠĠĠĠ Ġevery Ġ{ Ġname Resolver . resolve Name ( fc 1 ) Ġ} Ġreturns Ġ" foo " ĊĠĠĠĠĠĠĠ Ġevery Ġ{ Ġname Resolver . resolve Name ( constructor ) Ġ} Ġreturns Ġ" bar " ĊĊĠĠĠĠĠĠĠ Ġval Ġresult Ġ= Ġvalidator . validate ( all Elements . values ) ĊĊĠĠĠĠĠĠĠ ĠassertTrue ( result ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġvalidate Field Custom Construct ors Invalid () Ġ{ ĊĠĠĠĠĠĠĠ Ġevery Ġ{ Ġname Resolver . resolve Name ( fc 1 ) Ġ} Ġreturns Ġ" foo " ĊĠĠĠĠĠĠĠ Ġevery Ġ{ Ġname Resolver . resolve Name ( constructor ) Ġ} Ġreturns Ġ" foo " ĊĊĠĠĠĠĠĠĠ Ġval Ġresult Ġ= Ġvalidator . validate ( all Elements . values ) ĊĊĠĠĠĠĠĠĠ ĠassertFalse ( result ) ĊĠĠĠ Ġ} Ċ } Ċ