ReservationStep { public void execute() throws EnvironmentModificationException, PeerException { Set<Peer> newPeers = peerManager.resolve( topology.getAllPeers() ); newPeers.removeAll( environment.getPeers() ); if ( newPeers.isEmpty() ) { return; } final Map<Peer, UsedNetworkResources> reservedNetResources = obtainReservedNetResources( newPeers ); SubnetUtils subnetUtils = new SubnetUtils( environment.getSubnetCidr() ); final String containerSubnet = subnetUtils.getInfo().getNetworkAddress(); checkResourceAvailablility( reservedNetResources, containerSubnet ); reserveNetworkResources( newPeers, containerSubnet ); } ReservationStep( final Topology topology, final LocalEnvironment environment, final PeerManager peerManager,
                            final IdentityManager identityManager, final TrackerOperation trackerOperation ); void execute();  }
@Test( expected = EnvironmentModificationException.class ) public void testExecute() throws Exception { doReturn( 123 ).when( peerTaskResult ).getResult(); doReturn( true ).when( peerTaskResult ).hasSucceeded(); step.execute(); verify( environment ).addEnvironmentPeer( isA( EnvironmentPeerImpl.class ) ); doReturn( false ).when( peerTaskResult ).hasSucceeded(); doReturn( true ).when( peerTaskResults ).hasFailures(); step.execute(); }