@Test
public void testFindDestinations() {

    // Prepare
    when(mockDataCenter.getNetworkType()).thenReturn(NetworkType.Basic);
    when(mockDestination.getPod()).thenReturn(null);
    // Stub local method listByDataCenterIdVMTypeAndStates
    mockPods.add(mockHostPodVO1);
    mockPods.add(mockHostPodVO2);
    mockPods.add(mockHostPodVO3);
    final RouterDeploymentDefinition deployment = spy(this.deployment);
    doReturn(mockPods).when(deployment).listByDataCenterIdVMTypeAndStates(
            DATA_CENTER_ID, VirtualMachine.Type.User,
            VirtualMachine.State.Starting, VirtualMachine.State.Running);
    // Leave this one empty to force adding add destination for this pod
    final List<DomainRouterVO> virtualRouters1 = new ArrayList<>();
    when(mockRouterDao.listByPodIdAndStates(POD_ID1,
            VirtualMachine.State.Starting, VirtualMachine.State.Running)).thenReturn(virtualRouters1);
    // This list is not empty, so it will not add any for this pod, and continue with next pod
    final List<DomainRouterVO> virtualRouters2 = new ArrayList<>();
    final DomainRouterVO domainRouterVO1 = mock(DomainRouterVO.class);
    virtualRouters2.add(domainRouterVO1);
    when(mockRouterDao.listByPodIdAndStates(POD_ID2,
            VirtualMachine.State.Starting, VirtualMachine.State.Running)).thenReturn(virtualRouters2);
    // Leave this last one empty to check we finally added more than one afterwards
    final List<DomainRouterVO> virtualRouters3 = new ArrayList<>();
    when(mockRouterDao.listByPodIdAndStates(POD_ID3,
            VirtualMachine.State.Starting, VirtualMachine.State.Running)).thenReturn(virtualRouters3);
    // Execute
    final List<DeployDestination> destinations = deployment.findDestinations();
    // Assert that 2 were added (for the 1st and 3rd
    assertEquals("",
            2, destinations.size());
    assertEquals("",
            mockDataCenter, destinations.get(0).getDataCenter());
    assertEquals("",
            mockHostPodVO1, destinations.get(0).getPod());
    assertEquals("",
            mockDataCenter, destinations.get(1).getDataCenter());
    assertEquals("",
            mockHostPodVO3, destinations.get(1).getPod());
}