package Ġorg . umb re ll ah q . base app Ċ Ċ import Ġandroidx . test . espress o . Esp ress o Ċ import Ġandroidx . test . espress o . action . View Actions Ċ import Ġandroidx . test . espress o . assertion . View Assertions Ċ import Ġandroidx . test . espress o . matcher . View Matchers Ċ import Ġandroidx . test . ext . junit . runners . Android JUnit 4 Ċ import Ġandroidx . test . filters . Large Test Ċ import Ġandroidx . test . rule . Activity Test Rule Ċ import Ġorg . junit . Rule Ċ import Ġorg . junit . Test Ċ import Ġorg . junit . runner . RunWith Ċ import Ġorg . umb re ll ah q . base app . activities . MainActivity Ċ Ċ @ Large Test Ċ @ RunWith ( Android JUnit 4 :: class ) Ċ class ĠMain Fragment Test Ġ{ ĊĊĠĠĠ Ġ@ Rule ĊĠĠĠ Ġ@ Jvm Field ĊĠĠĠ Ġvar Ġm Activity Test Rule Ġ= ĠActivity Test Rule ( MainActivity :: class . java ) ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġfind Fab Add Task _ should Exist () Ġ{ ĊĠĠĠĠĠĠĠ ĠE sp ress o . on View ( View Matchers . with Id ( R . id . fab Add Task )). check ( View Assertions . matches ( View Matchers . is Displayed ())) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġclick Fab Add Task _ three Times _ should Display Three Tasks () Ġ{ ĊĠĠĠĠĠĠĠ ĠE sp ress o . on View ( View Matchers . with Id ( R . id . fab Add Task )). perform ( View Actions . click ()) ĊĠĠĠĠĠĠĠ ĠE sp ress o . on View ( View Matchers . with Id ( R . id . fab Add Task )). perform ( View Actions . click ()) ĊĠĠĠĠĠĠĠ ĠE sp ress o . on View ( View Matchers . with Id ( R . id . fab Add Task )). perform ( View Actions . click ()) ĊĊĠĠĠĠĠĠĠ ĠE sp ress o . on View ( View Matchers . with Id ( R . id . rv Tasks )). check ( View Assertions . matches ( View Matchers . has Desc endant ( View Matchers . with Text (" New ĠTask Ġ 2 ")) )) ĊĠĠĠ Ġ} Ċ } Ċ