package Ġcom . github . ker ub istan . ker ub . security Ċ Ċ import Ġcom . github . ker ub istan . ker ub . data . hub . Any Entity Dao Ċ import Ġcom . github . ker ub istan . ker ub . model . Host Ċ import Ġcom . github . ker ub istan . ker ub . model . VirtualMachine Ċ import Ġcom . github . ker ub istan . ker ub . model . VirtualMachine Status Ċ import Ġcom . github . ker ub istan . ker ub . model . Virtual Network Ċ import Ġcom . github . ker ub istan . ker ub . model . Virtual Storage Device Ċ import Ġcom . github . ker ub istan . ker ub . model . dynamic . Host Dynamic Ċ import Ġcom . github . ker ub istan . ker ub . model . dynamic . VirtualMachine Dynamic Ċ import Ġcom . github . ker ub istan . ker ub . model . dynamic . Virtual Storage Device Dynamic Ċ import Ġcom . github . ker ub istan . ker ub . test Host Ċ import Ġcom . github . ker ub istan . ker ub . test Virtual Disk Ċ import Ġcom . github . ker ub istan . ker ub . test Virtual Network Ċ import Ġcom . github . ker ub istan . ker ub . test Vm Ċ 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 . never Ċ import Ġcom . n ha ar man . mockito _ kotlin . verify Ċ import Ġcom . n ha ar man . mockito _ kotlin . wh enever Ċ import Ġio . github . ker ub istan . k ro ki . size . GB Ċ import Ġorg . junit . Assert . assertEquals Ċ import Ġorg . junit . Test Ċ import Ġkotlin . test . assertNull Ċ Ċ class ĠEntity Access Controller Impl Test Ġ{ ĊĊ ĉ private Ġval Ġasset Access Controller : ĠAsset Access Controller Ġ= Ġmock () Ċ ĉ private Ġval Ġany Entity Dao : ĠAny Entity Dao Ġ= Ġmock () ĊĊ ĉ @ Test Ċ ĉ fun Ġstat Class Of () Ġ{ Ċĉ ĉ assertEquals ( VirtualMachine :: class , ĠEntity Access Controller Impl . stat Class Of ( VirtualMachine Dynamic :: class )) Ċĉ ĉ assertEquals ( Ċĉĉĉ ĉ Virtual Storage Device :: class , Ċĉĉĉ ĉ Entity Access Controller Impl . stat Class Of ( Virtual Storage Device Dynamic :: class ) Ċĉ ĉ ) Ċĉ ĉ assertEquals ( Ċĉĉĉ ĉ Host :: class , Ċĉĉĉ ĉ Entity Access Controller Impl . stat Class Of ( Host Dynamic :: class ) Ċĉ ĉ ) ĊĊĉ ĉ assertNull ( Entity Access Controller Impl . stat Class Of ( Host :: class )) Ċ ĉ } ĊĊ ĉ @ Test Ċ ĉ fun Ġstat From Dynamic () Ġ{ Ċĉ ĉ val Ġdyn Ġ= ĠVirtual Machine Dynamic ( Ċĉĉĉ ĉ id Ġ= Ġtest Vm . id , Ċĉĉĉ ĉ memory Used Ġ= Ġ 1 . GB , Ċĉĉĉ ĉ status Ġ= ĠVirtual Machine Status . Up , Ċĉĉĉ ĉ host Id Ġ= Ġtest Host . id Ċĉ ĉ ) Ċĉ ĉ wh enever ( any Entity Dao . get ( eq ( VirtualMachine :: class ), Ġeq ( test Vm . id ))). thenReturn ( test Vm ) Ċĉ ĉ assertEquals ( test Vm , ĠEntity Access Controller Impl ( asset Access Controller , Ġany Entity Dao ). stat From Dynamic ( dyn )) Ċ ĉ } ĊĊ ĉ @ Test Ċ ĉ fun Ġcheck And Do With Asset () Ġ{ Ċĉ ĉ val Ġaction Ġ= Ġmock < () Ġ-> ĠVirtual Network >() Ċĉ ĉ Entity Access Controller Impl ( asset Access Controller , Ġany Entity Dao ). check And Do ( test Virtual Network , Ġaction ) Ċĉ ĉ verify ( asset Access Controller ). check And Do ( eq ( test Virtual Network ), Ġeq ( action )) Ċĉ ĉ verify ( action , Ġnever ()). invoke () Ċ ĉ } ĊĊ ĉ @ Test Ċ ĉ fun Ġcheck And Do With Dyn () Ġ{ Ċĉ ĉ val Ġaction Ġ= Ġmock < () Ġ-> ĠVirtual Storage Device Dynamic >() Ċĉ ĉ Entity Access Controller Impl ( asset Access Controller , Ġany Entity Dao ). check And Do ( test Virtual Disk , Ġaction ) Ċĉ ĉ verify ( asset Access Controller ). check And Do ( eq ( test Virtual Disk ), Ġeq ( action )) Ċĉ ĉ verify ( action , Ġnever ()). invoke () Ċ ĉ } Ċ Ċ }