VirtualMachineService { public VMInstanceVO searchVmInstanceById(Long vmId) { return vmInstanceDao.findById(vmId); }  VMInstanceVO searchVmInstanceById(Long vmId); void update(long id, VMInstanceVO vmInstance); void remove(long id);  }
@Test public void searchVmInstanceByIdTest() { VMInstanceVO vm = Mockito.mock(VMInstanceVO.class); Mockito.doReturn(vm).when(vmInstanceDao).findById(Mockito.anyLong()); VMInstanceVO result = spy.searchVmInstanceById(0l); Mockito.verify(vmInstanceDao).findById(Mockito.anyLong()); Assert.assertEquals(vm, result); }