}
@Test
public void testEnsureNetworkExistsWithProvidedExistingNetwork() throws Exception {
final String networkId = "network-id-0123";
final CloudStackClient mockClient = mock(CloudStackClient.class);
final NetworkClient mockNetworkClient = mock(NetworkClient.class);
final Network mockNetwork = mock(Network.class);
final org.apache.provisionr.api.network.Network network = org.apache.provisionr.api.network.Network.builder()
.option(NetworkOptions.EXISTING_NETWORK_ID, networkId).createNetwork();
execution.setVariable(ProcessVariables.NETWORK_ID, networkId);
when(pool.getNetwork()).thenReturn(network);
when(mockClient.getNetworkClient()).thenReturn(mockNetworkClient);
when(mockNetworkClient.getNetwork(networkId)).thenReturn(mockNetwork);
when(mockNetwork.getId()).thenReturn(networkId);
activity.execute(mockClient, pool, execution);
assertThat(collector.getVariable(ProcessVariables.NETWORK_ID)).isEqualTo(networkId);