package Ġc afe . ad riel . k apt ain Ċ Ċ import Ġandroid . content . Intent Ċ import Ġandroid . os . Build Ċ import Ġc afe . ad riel . k apt ain . util . Test Activity Ċ import Ġc afe . ad riel . k apt ain . util . Test Destination Ċ import Ġorg . junit . Test Ċ import Ġorg . junit . runner . RunWith Ċ import Ġorg . ro bo lectric . Ro bo lectric Ċ import Ġorg . ro bo lectric . Ro bo lectric TestRunner Ċ import Ġorg . ro bo lectric . Shadow s . shadow Of Ċ import Ġorg . ro bo lectric . annotation . Config Ċ import Ġstri kt . api . expect Ċ import Ġstri kt . api . expect That Ċ import Ġstri kt . api . expect Throws Ċ import Ġstri kt . assertions . isEqualTo Ċ import Ġstri kt . assertions . isNotNull Ċ import Ġstri kt . assertions . isNull Ċ Ċ @ RunWith ( Ro bo lectric TestRunner :: class ) Ċ @ Config ( sdk Ġ= Ġ[ Build . VERSION _ CODES . P ]) Ċ class ĠK apt ain Test Ġ{ ĊĊĠĠĠ Ġprivate Ġval Ġk apt ain Ġ= ĠK apt ain Ġ{ ĊĠĠĠĠĠĠĠ Ġadd < Test Destination . Some Place , ĠTest Activity >() ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġval ĠstartActivity Ġ= ĠRo bo lectric . build Activity ( Test Activity :: class . java ). get () ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` navigate Ġshould Ġstart Ġa Ġnew Ġactivity `() Ġ{ ĊĠĠĠĠĠĠĠ Ġk apt ain . navigate ( startActivity , ĠTest Destination . Some Place (" A ho y ! ")) ĊĊĠĠĠĠĠĠĠ Ġval Ġintent Ġ= Ġshadow Of ( startActivity ). next Started Activity ĊĠĠĠĠĠĠĠ Ġval ĠclassName Ġ= Ġshadow Of ( intent ). intent Class . canonical Name ĊĊĠĠĠĠĠĠĠ Ġexpect That ( className ) Ġis EqualTo ĠTest Activity :: class . qualified Name ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` navigate Ġshould Ġstart Ġa Ġnew Ġactivity Ġfor Ġresult `() Ġ{ ĊĠĠĠĠĠĠĠ Ġk apt ain . navigate ( startActivity , ĠTest Destination . Some Place (" A ho y ! "), Ġ 0 x 1 2 3 ) ĊĊĠĠĠĠĠĠĠ Ġval Ġintent For Result Ġ= Ġshadow Of ( startActivity ). next Started Activity For Result ĊĠĠĠĠĠĠĠ Ġval ĠclassName Ġ= Ġshadow Of ( intent For Result . intent ). intent Class . canonical Name ĊĠĠĠĠĠĠĠ Ġval Ġrequest Code Ġ= Ġintent For Result . request Code ĊĊĠĠĠĠĠĠĠ Ġexpect Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġthat ( className ) Ġis EqualTo ĠTest Activity :: class . qualified Name ĊĠĠĠĠĠĠĠĠĠĠĠ Ġthat ( request Code ) Ġis EqualTo Ġ 0 x 1 2 3 ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` navigate Ġshould Ġthrow Ġan Ġexception Ġif Ġdestination Ġwasn 't Ġfound `() Ġ{ ĊĠĠĠĠĠĠĠ Ġexpect Throws < K apt ain Exception > Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġk apt ain . navigate ( startActivity , ĠTest Destination . Unknown Place ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` extra Ġshould Ġreturn Ġthe Ġcorrect Ġdestination `() Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġdestination Intent Ġ= ĠIntent ( startActivity , ĠTest Activity :: class . java ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. putExtra ( K apt ain . EXTRA _ DEST INATION , ĠTest Destination . Some Place (" A ho y ! ")) ĊĠĠĠĠĠĠĠ Ġval Ġdestination Activity Ġ= ĠRo bo lectric ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. build Activity ( Test Activity :: class . java , Ġdestination Intent ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. get () ĊĊĠĠĠĠĠĠĠ Ġval Ġdestination Ġ= Ġk apt ain . from Intent < Test Destination . Some Place >( destination Activity ) ĊĊĠĠĠĠĠĠĠ Ġexpect That ( destination ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġis NotNull () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġget Ġ{ Ġthis ?. message Ġ} Ġis EqualTo Ġ" A ho y !" ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` extra Ġshould Ġreturn Ġnull Ġif Ġdestination Ġwasn 't Ġfound `() Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġdestination Activity Ġ= ĠRo bo lectric . build Activity ( Test Activity :: class . java ). get () ĊĊĠĠĠĠĠĠĠ Ġval Ġdestination Ġ= Ġk apt ain . from Intent < Test Destination . Unknown Place >( destination Activity ) ĊĊĠĠĠĠĠĠĠ Ġexpect That ( destination ). isNull () ĊĠĠĠ Ġ} Ċ }