package Ġcom . code bor ne . se len ide . commands Ċ Ċ import Ġassert k . assertions . is Failure Ċ import Ġassert k . assertions . isInstanceOf Ċ import Ġcom . code bor ne . se len ide . Sel en ide Element Ċ import Ġcom . code bor ne . se len ide . impl . WebElement Source Ċ import Ġkotlinx . coroutines . Experimental Cor outines Api Ċ import Ġkotlinx . coroutines . test . run Blocking Test Ċ import Ġorg . assertj . core . api . With Assertions Ċ import Ġorg . junit . jupiter . api . Test Ċ import Ġorg . mockito . Mockito Ċ import Ġorg . openqa . selenium . By Ċ Ċ @ Experimental Cor outines Api Ċ internal Ġclass ĠFind Command Test Ġ: ĠWith Assertions Ġ{ ĊĠĠĠ Ġprivate Ġval Ġproxy Ġ= ĠMockito . mock ( Sel en ide Element :: class . java ) ĊĠĠĠ Ġprivate Ġval Ġlocator Ġ= ĠMockito . mock ( WebElement Source :: class . java ) ĊĠĠĠ Ġprivate Ġval Ġelement 1 Ġ= ĠMockito . mock ( Sel en ide Element :: class . java ) ĊĠĠĠ Ġprivate Ġval Ġfind Command Ġ= ĠFind () ĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtest Execute Method With No Args Passed () Ġ= Ġrun Blocking Test Ġ{ ĊĠĠĠĠĠĠĠ Ġassert k . assertThat Ġ{ Ġfind Command . execute ( proxy , Ġlocator , ĠarrayOf ()) Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. is Failure () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. isInstanceOf ( ArrayIndex OutOfBoundsException :: class . java ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtest Execute Method With Zero Length Args () Ġ= Ġrun Blocking Test Ġ{ ĊĠĠĠĠĠĠĠ ĠMockito .` when `( locator . find ( proxy , ĠBy . xpath (" .. "), Ġ 0 )). thenReturn ( element 1 ) ĊĠĠĠĠĠĠĠ ĠassertThat < Any >( find Command . execute ( proxy , Ġlocator , ĠarrayOf < Any >( By . xpath (" .. ")) )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. isEqualTo ( element 1 ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtest Execute Method With More Then One Args List () Ġ= Ġrun Blocking Test Ġ{ ĊĠĠĠĠĠĠĠ ĠMockito .` when `( locator . find ( proxy , ĠBy . xpath (" .. "), Ġ 1 )). thenReturn ( element 1 ) ĊĠĠĠĠĠĠĠ ĠassertThat < Any >( find Command . execute ( proxy , Ġlocator , ĠarrayOf ( By . xpath (" .. "), Ġ 1 ))) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. isEqualTo ( element 1 ) ĊĠĠĠ Ġ} Ċ } Ċ