package Ġuk . co . j ake lee . d agger experiments . ba eld ung Ċ Ċ import Ġorg . junit . Assert Ċ import Ġorg . junit . Test Ċ Ċ class ĠBa eld ung Tests Ġ{ ĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġgiven Generated Component _ when Building Car _ then Dependencies Inject ed () Ġ{ ĊĠĠĠĠĠĠĠ Ġ// ĠD agger 's Ġimplementation Ġof Ġthe Ġ` Veh icles Component ` Ġinterface Ġ( a Ġcar Ġfactory !) ĊĠĠĠĠĠĠĠ Ġval Ġcomponent Ġ= ĠD agger Veh icles Component . create () ĊĊĠĠĠĠĠĠĠ Ġ// ĠAssert Ġcar Ġ 1 Ġexists ĊĠĠĠĠĠĠĠ Ġval Ġcar One Ġ= Ġcomponent . build Car () ĊĠĠĠĠĠĠĠ ĠAssert . assertNotNull ( car One ) ĊĠĠĠĠĠĠĠ ĠAssert . assertNotNull ( car One . url ) ĊĠĠĠĠĠĠĠ ĠAssert . assertNotNull ( car One . engine ) ĊĠĠĠĠĠĠĠ ĠAssert . assertNotNull ( car One . brand ) ĊĊĠĠĠĠĠĠĠ Ġ// ĠAssert Ġcar Ġ 2 Ġexists ĊĠĠĠĠĠĠĠ Ġval Ġcar Two Ġ= Ġcomponent . build Car () ĊĠĠĠĠĠĠĠ ĠAssert . assertNotNull ( car Two ) ĊĠĠĠĠĠĠĠ ĠAssert . assertNotNull ( car Two . url ) ĊĠĠĠĠĠĠĠ ĠAssert . assertNotNull ( car Two . engine ) ĊĠĠĠĠĠĠĠ ĠAssert . assertNotNull ( car Two . brand ) ĊĊĠĠĠĠĠĠĠ Ġ// ĠNon - singleton Ġobjects Ġare Ġdifferent , Ġsingleton Ġobjects Ġare Ġthe Ġsame ĊĠĠĠĠĠĠĠ ĠAssert . assertEquals ( car One . url , Ġcar Two . url ) ĊĠĠĠĠĠĠĠ ĠAssert . assertEquals ( car One . brand , Ġcar Two . brand ) ĊĠĠĠĠĠĠĠ ĠAssert . assertNot Equals ( car One . engine , Ġcar Two . engine ) ĊĠĠĠ Ġ} Ċ } Ċ