package Ġcom . github . ker ub istan . ker ub . planner . steps . host . security . clear Ċ Ċ import Ġcom . github . ker ub istan . ker ub . data . config . Host Configuration Dao Ċ import Ġcom . github . ker ub istan . ker ub . host . Host Command Executor Ċ import Ġcom . github . ker ub istan . ker ub . host . mock Host Ċ import Ġcom . github . ker ub istan . ker ub . model . config . Host Configuration Ċ import Ġcom . github . ker ub istan . ker ub . test Host Ċ import Ġcom . n ha ar man . mockito _ kotlin . any Ċ import Ġcom . n ha ar man . mockito _ kotlin . eq Ċ import Ġcom . n ha ar man . mockito _ kotlin . mock Ċ import Ġcom . n ha ar man . mockito _ kotlin . verify Ċ import Ġcom . n ha ar man . mockito _ kotlin . wh enever Ċ import Ġorg . apache . ss hd . client . session . Client Session Ċ import Ġorg . apache . ss hd . client . subsystem . sf tp . S ftp Client Ċ import Ġorg . junit . Test Ċ import Ġkotlin . test . assertTrue Ċ Ċ class ĠClear Ssh Key Executor Test Ġ{ ĊĊ ĉ @ Test Ċ ĉ fun Ġexecute () Ġ{ Ċĉ ĉ val Ġhost Command Executor Ġ= Ġmock < Host Command Executor >() Ċĉ ĉ val Ġhost Cfg Dao Ġ= Ġmock < Host Configuration Dao >() Ċĉ ĉ val Ġsession Ġ= Ġmock < Client Session >() Ċĉ ĉ val Ġs ftp Client Ġ= Ġmock < S ftp Client >() Ċĉ ĉ wh enever ( session . create S ftp Client ()). thenReturn ( sf tp Client ) Ċĉ ĉ host Command Executor . mock Host ( test Host , Ġsession ) Ċĉ ĉ wh enever ( host Cfg Dao . update ( any (), Ġany (), Ġany ())). then Ġ{ Ċĉĉ ĉ val Ġupdated Ġ= Ġ( it . arguments [ 2 ] Ġas Ġ( Host Configuration ) Ġ-> ĠHost Configuration ). invoke ( Ċĉĉĉĉ ĉ Host Configuration ( id Ġ= Ġtest Host . id ) Ċĉĉ ĉ ) Ċĉĉ ĉ assertTrue Ġ{ Ċĉĉĉ ĉ updated . id Ġ== Ġtest Host . id Ċĉĉ ĉ } Ċĉĉ ĉ assertTrue Ġ{ Ċĉĉĉ ĉ updated . publicKey Ġ== Ġnull Ċĉĉ ĉ } Ċĉĉ ĉ updated Ċĉ ĉ } ĊĊĉ ĉ Clear Ssh Key Executor ( host Command Executor , Ġhost Cfg Dao ). execute ( Clear Ssh Key ( host Ġ= Ġtest Host )) ĊĊĉ ĉ verify ( host Cfg Dao ). update ( eq ( test Host . id ), Ġretrieve Ġ= Ġany (), Ġchange Ġ= Ġ Ġany ()) Ċ ĉ } Ċ }