### Question:
DecreaseNumberOfReplicas extends BaseAction { @Override public void applyUpdate() throws UpdateActionFailedException { int decreaseAmount = currentService.getSpec().getNumberOfInstances() - newSpec.getNumberOfInstances(); ServiceUndeploymentPreparer undeploymentPreparer = ServiceUndeploymentPreparerFactory.getNewInstance( currentService, decreaseAmount); try { undeploymentPreparer.prepareUndeployment(); currentService.setSpec(newSpec); } catch (Exception e) { throw new UpdateActionFailedException(); } } DecreaseNumberOfReplicas(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); DecreaseNumberOfReplicas action = new DecreaseNumberOfReplicas(airlineService, newSpec); action.applyUpdate(); assertEquals(newSpec, airlineService.getSpec()); ServiceUndeploymentPreparerFactory.testing = false; }