package Ġcom . example . ti ptime čĊč Ċ import Ġandroidx . test . espress o . Esp ress o . on View č Ċ import Ġandroidx . test . espress o . action . View Actions . click č Ċ import Ġandroidx . test . espress o . action . View Actions . type Text č Ċ import Ġandroidx . test . ext . junit . rules . Activity Scenario Rule č Ċ import Ġandroidx . test . ext . junit . runners . Android JUnit 4 č Ċ import Ġorg . junit . Rule č Ċ import Ġorg . junit . Test č Ċ import Ġorg . junit . runner . RunWith č Ċ import Ġandroidx . test . espress o . assertion . View Assertions . matches č Ċ import Ġandroidx . test . espress o . matcher . View Matchers . with Id č Ċ import Ġandroidx . test . espress o . matcher . View Matchers . with Text č Ċ import Ġorg . hamcrest . Matchers . contains String čĊč Ċ @ RunWith ( Android JUnit 4 :: class ) č Ċ class ĠCalculator Tests Ġ{ čĊĠĠĠ Ġ@ get : Rule () čĊĠĠĠ Ġval Ġactivity Ġ= ĠActivity Scenario Rule ( MainActivity :: class . java ) čĊĠĠĠ Ġ@ Test čĊĠĠĠ Ġfun Ġcalculate _ default _ tip () Ġ{ čĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . cost _ of _ service _ edit _ text )). perform ( type Text (" 5 0 . 0 0 ")) čĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . calculate _ button )). perform ( click ()) čĊĠĠĠĠĠĠĠ Ġon View ( with Id ( R . id . tip _ result )). check ( matches ( with Text ( contains String (" 1 0 . 0 0 ")) )) čĊĠĠĠ Ġ} č Ċ }