package Ġcom . kar umi . shot . compose Ċ Ċ import Ġandroidx . compose . ui . test . Semantics Node Interaction Ċ import Ġcom . n ha ar man . mockito _ kotlin .* Ċ import Ġjunit . framework . TestCase . assertEquals Ċ import Ġorg . junit . Before Ċ import Ġorg . junit . Test Ċ import Ġorg . junit . runner . RunWith Ċ import Ġorg . mockito . Mock Ċ import Ġorg . mockito . junit . Mockito JUnit Runner Ċ Ċ @ RunWith ( Mockito JUnit Runner :: class ) Ċ class ĠCompose Screenshot Test Ġ{ ĊĊĠĠĠ Ġcompanion Ġobject Ġ{ ĊĠĠĠĠĠĠĠ Ġprivate Ġval Ġany Screenshot Metadata : ĠScreen shot Metadata Ġ= ĠScreen shot Metadata (" test 1 ", Ġ" MainActivity Test ", Ġ" test Name 1 ") ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġcompose Screenshot : ĠCompose Screenshot ĊĊĠĠĠ Ġ@ Mock ĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġscreenshot Saver : ĠScreen shot Saver ĊĊĠĠĠ Ġ@ Mock ĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġnode : ĠSem antics Node Interaction ĊĊĠĠĠ Ġ@ Before ĊĠĠĠ Ġfun ĠsetUp () Ġ{ ĊĠĠĠĠĠĠĠ Ġcompose Screenshot Ġ= ĠCompose Screenshot ( Screenshot Test Session (), Ġscreenshot Saver ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġsaves The New Screenshot As Part Of The Session Metadata () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġdata Ġ= Ġany Screenshot Metadata ĊĊĠĠĠĠĠĠĠ Ġcompose Screenshot . save Screenshot ( node , Ġdata ) ĊĊĠĠĠĠĠĠĠ Ġval Ġexpected Session Metadata Ġ= ĠScreen shot Session Metadata ( listOf ( data )) ĊĠĠĠĠĠĠĠ ĠassertEquals ( expected Session Metadata , Ġcompose Screenshot . save Metadata (). get Screenshot Session Metadata ()) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġwhenever AN ew Screenshot Is Saved The Node Associated Is Saved Into The Sd Card () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġdata Ġ= Ġany Screenshot Metadata ĊĊĠĠĠĠĠĠĠ Ġcompose Screenshot . save Screenshot ( node , Ġdata ) ĊĊĠĠĠĠĠĠĠ Ġverify ( screenshot Saver ). save Screenshot ( Screenshot To Save ( Screenshot Source . Node ( node ), Ġdata )) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġafter Adding Some Screenshots When The Save Metadata Is Inv oked All The Session Is Saved Into The Sd Card () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġdata Ġ= Ġany Screenshot Metadata ĊĊĠĠĠĠĠĠĠ Ġcompose Screenshot . save Screenshot ( node , Ġdata ) ĊĠĠĠĠĠĠĠ Ġcompose Screenshot . save Screenshot ( node , Ġdata ) ĊĠĠĠĠĠĠĠ Ġcompose Screenshot . save Screenshot ( node , Ġdata ) ĊĠĠĠĠĠĠĠ Ġcompose Screenshot . save Metadata () ĊĊĠĠĠĠĠĠĠ Ġval Ġcapt or Ġ= Ġargument Captor < Screenshot Test Session >() ĊĠĠĠĠĠĠĠ Ġverify ( screenshot Saver ). save Metadata ( capt or . capture ()) ĊĊĠĠĠĠĠĠĠ Ġval Ġactual Session Ġ= Ġcapt or . last Value ĊĠĠĠĠĠĠĠ Ġval Ġactual Session Metadata Ġ= Ġactual Session . get Screenshot Session Metadata () ĊĠĠĠĠĠĠĠ ĠassertEquals ( 3 , Ġactual Session Metadata . screenshots Data . size ) ĊĠĠĠĠĠĠĠ Ġfor Ġ( i Ġin Ġ 0 Ġuntil Ġ 3 ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertEquals ( data , Ġactual Session Metadata . screenshots Data [ i ]) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġwhen No Screenshots W ere Saved The Metadata IsNot Saved () Ġ{ ĊĠĠĠĠĠĠĠ Ġcompose Screenshot . save Metadata () ĊĠĠĠĠĠĠĠ Ġverify ( screenshot Saver , Ġnever ()). save Metadata ( any ()) ĊĠĠĠ Ġ} Ċ } Ċ