package Ġcom . github . ash ut osh g ng wr . no ice . fragment Ċ Ċ import Ġandroidx . fragment . app . testing . Fragment Scenario Ċ import Ġandroidx . fragment . app . testing . launch Fragment In Container Ċ import Ġandroidx . test . espress o . Esp ress o Ċ import Ġandroidx . test . espress o . action . View Actions Ċ import Ġandroidx . test . espress o . matcher . View Matchers . with Id Ċ import Ġandroidx . test . ext . junit . runners . Android JUnit 4 Ċ import Ġcom . github . ash ut osh g ng wr . no ice . In App Review Flow Manager Ċ import Ġcom . github . ash ut osh g ng wr . no ice . R Ċ import Ġcom . github . ash ut osh g ng wr . no ice . Retry Test Rule Ċ import Ġcom . github . ash ut osh g ng wr . no ice . model . Sound Ċ import Ġcom . github . ash ut osh g ng wr . no ice . playback . Playback Controller Ċ import Ġio . mock k . clear Mocks Ċ import Ġio . mock k . mock k Object Ċ import Ġio . mock k . un mock k All Ċ import Ġio . mock k . verify Ċ import Ġorg . junit . After Ċ import Ġorg . junit . Before Ċ import Ġorg . junit . Rule Ċ import Ġorg . junit . Test Ċ import Ġorg . junit . runner . RunWith Ċ Ċ @ RunWith ( Android JUnit 4 :: class ) Ċ class ĠRandom Preset Fragment Test Ġ{ ĊĊĠ Ġ@ Rule ĊĠ Ġ@ Jvm Field ĊĠ Ġval Ġretry Test Rule Ġ= ĠRetry Test Rule ( 5 ) ĊĊĠ Ġprivate Ġlateinit Ġvar Ġfragment Scenario : ĠFragment Scenario < Random Preset Fragment > ĊĊĠ Ġ@ Before ĊĠ Ġfun Ġsetup () Ġ{ ĊĠĠĠ Ġmock k Object ( In App Review Flow Manager , ĠPlay back Controller ) ĊĠĠĠ Ġfragment Scenario Ġ= Ġlaunch Fragment In Container ( null , ĠR . style . Theme _ App ) ĊĠ Ġ} ĊĊĠ Ġ@ After ĊĠ Ġfun Ġteardown () Ġ{ ĊĠĠĠ Ġun mock k All () ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġtest Random Preset Button _ onClick () Ġ{ ĊĠĠĠ Ġval Ġintensity Expectations Ġ= Ġmap Of ( ĊĠĠĠĠĠ ĠR . id . preset _ intensity __ any Ġto ĠRandom Preset Fragment . RANGE _ INT ENS ITY _ ANY , ĊĠĠĠĠĠ ĠR . id . preset _ intensity __ dense Ġto ĠRandom Preset Fragment . RANGE _ INT ENS ITY _ D ENSE , ĊĠĠĠĠĠ ĠR . id . preset _ intensity __ light Ġto ĠRandom Preset Fragment . RANGE _ INT ENS ITY _ LIGHT ĊĠĠĠ Ġ) ĊĊĠĠĠ Ġval Ġtype Expectations Ġ= Ġmap Of ( ĊĠĠĠĠĠ ĠR . id . preset _ type __ any Ġto Ġnull , ĊĠĠĠĠĠ ĠR . id . preset _ type __ focus Ġto ĠSound . Tag . FOCUS , ĊĠĠĠĠĠ ĠR . id . preset _ type __ relax Ġto ĠSound . Tag . REL AX ĊĠĠĠ Ġ) ĊĊĠĠĠ Ġfor Ġ(( type ID , Ġtag ) Ġin Ġtype Expectations ) Ġ{ ĊĠĠĠĠĠ Ġfor Ġ(( intensity ID , Ġintensity Range ) Ġin Ġintensity Expectations ) Ġ{ ĊĠĠĠĠĠĠĠ ĠE sp ress o . on View ( with Id ( type ID )). perform ( View Actions . click ()) ĊĠĠĠĠĠĠĠ ĠE sp ress o . on View ( with Id ( intensity ID )). perform ( View Actions . click ()) ĊĊĠĠĠĠĠĠĠ ĠE sp ress o . on View ( with Id ( R . id . play _ preset _ button )) ĊĠĠĠĠĠĠĠĠĠ Ġ. perform ( View Actions . click ()) ĊĊĠĠĠĠĠĠĠ Ġverify ( exact ly Ġ= Ġ 1 ) Ġ{ ĠPlay back Controller . play Random Preset ( any (), Ġtag , Ġintensity Range ) Ġ} ĊĠĠĠĠĠĠĠ Ġclear Mocks ( Playback Controller ) ĊĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĠ Ġ} Ċ } Ċ