### Question:
IncreaseNumberOfReplicas extends BaseAction { @Override public void applyUpdate() throws UpdateActionFailedException { int increaseAmount = newSpec.getNumberOfInstances() - currentService.getSpec().getNumberOfInstances(); DeployableServiceSpec deltaSpec = newSpec.clone(); deltaSpec.setNumberOfInstances(increaseAmount); ServiceDeploymentPreparer deploymentPreparer = ServiceDeploymentPreparerFactory.getNewInstance(deltaSpec, currentService); try { Set<CloudNode> nodes = deploymentPreparer.prepareDeployment(); currentService.setSpec(newSpec); for (CloudNode node : nodes) currentService.addSelectedNode(node); } catch (PrepareDeploymentFailedException e) { throw new UpdateActionFailedException(); } } IncreaseNumberOfReplicas(DeployableService currentService, DeployableServiceSpec newSpec); @Override void applyUpdate(); @Override String getName();  }### Answer:
@Test public void test() throws UpdateActionFailedException { DeployableServiceSpec newSpec = airlineService.getSpec().clone(); newSpec.setNumberOfInstances(2); assertEquals(1, airlineService.getSelectedNodes().size()); CloudNode originalNode = airlineService.getSelectedNodes().iterator().next(); IncreaseNumberOfReplicas action = new IncreaseNumberOfReplicas(airlineService, newSpec); action.applyUpdate(); assertEquals(newSpec, airlineService.getSpec()); assertEquals(2, airlineService.getSelectedNodes().size()); boolean foundOriginal = false; boolean foundNewNode = false; for (CloudNode node : airlineService.getSelectedNodes()) { if (node.equals(originalNode)) foundOriginal = true; if (node.equals(node)) foundNewNode = true; } assertTrue(foundOriginal); assertTrue(foundNewNode); }