HostService { @Transactional(readOnly = false) public void updateHostPrivaceMacAddress(HostVO hostVo, String privateMacAddress) { hostVo.setPrivateMacAddress(privateMacAddress); hostDao.update(hostVo.getId(), hostVo); }  boolean isHostUpAndEnabled(long hostId); boolean isHostInMaintenanceError(long hostId); boolean isHostInPreparedForMaintenance(long hostId); @Transactional(readOnly = false) void markHostAsShutdownByAdministrationAgent(long id); void loadHostDetails(HostVO host); List<HypervisorType> getAllHypervisorsTypeInCloud(); HostVO findHostById(Long hostId); List<HostVO> listAllHostsInCluster(Cluster cluster); List<VMInstanceVO> listAllVmsFromHost(long hostId); @Transactional(readOnly = false) void updateHostPrivaceMacAddress(HostVO hostVo, String privateMacAddress); boolean isHostDown(long id); boolean isThereAnyHostOnCloudDeactivatedByOurManager();  }
@Test public void updateHostPrivaceMacAddressTest() { HostVO host = Mockito.mock(HostVO.class); Mockito.doNothing().when(host).setPrivateMacAddress(Mockito.anyString()); Mockito.when(host.getId()).thenReturn(0l); Mockito.doReturn(true).when(hostDao).update(Mockito.anyLong(), Mockito.any(HostVO.class)); spy.updateHostPrivaceMacAddress(host, "privateMacAddress"); Mockito.verify(host).setPrivateMacAddress(Mockito.anyString()); Mockito.verify(host).getId(); Mockito.verify(hostDao).update(Mockito.anyLong(), Mockito.any(HostVO.class)); }