if (campaign1 == null || campaign2 == null) {
this.testCreateCampaigns();
}
// Create campaign.
Campaign campaign1 = new Campaign();
campaign1.setId(this.campaign1.getId());
campaign1.setStatus(CampaignStatus.DELETED);
Campaign campaign2 = new Campaign();
campaign2.setId(this.campaign2.getId());
campaign2.setStatus(CampaignStatus.DELETED);
// Create and set budget.
Budget budget = new Budget();
budget.setPeriod(BudgetBudgetPeriod.DAILY);
budget.setAmount(new Money(null, 3000000L));
budget.setDeliveryMethod(BudgetBudgetDeliveryMethod.STANDARD);
campaign1.setBudget(budget);
campaign2.setBudget(budget);
// Create operations.
CampaignOperation operation1 = new CampaignOperation();
operation1.setOperand(campaign1);
operation1.setOperator(Operator.SET);
CampaignOperation operation2 = new CampaignOperation();
operation2.setOperand(campaign2);
operation2.setOperator(Operator.SET);
CampaignOperation[] operations = new CampaignOperation[] {operation1, operation2};
CampaignReturnValue result = campaignService.mutate(operations);
Campaign testCampaign1 = result.getValue()[0];
Campaign testCampaign2 = result.getValue()[1];
// Set the updated fields.
this.campaign1.setStatus(CampaignStatus.DELETED);
budget.getAmount().setComparableValueType(
testCampaign1.getBudget().getAmount().getComparableValueType());
this.campaign1.setBudget(budget);
this.campaign2.setStatus(CampaignStatus.DELETED);
budget.getAmount().setComparableValueType(
testCampaign2.getBudget().getAmount().getComparableValueType());
this.campaign2.setBudget(budget);
// Set the generated fields.
this.campaign1.setCampaignStats(testCampaign1.getCampaignStats());
this.campaign1.setAdServingOptimizationStatus(testCampaign1.getAdServingOptimizationStatus());
this.campaign1.setServingStatus(testCampaign1.getServingStatus());
this.campaign1.setConversionOptimizerEligibility(testCampaign1
.getConversionOptimizerEligibility());
this.campaign2.setCampaignStats(testCampaign2.getCampaignStats());
this.campaign2.setAdServingOptimizationStatus(testCampaign2.getAdServingOptimizationStatus());
this.campaign2.setServingStatus(testCampaign2.getServingStatus());
this.campaign2.setConversionOptimizerEligibility(testCampaign2
.getConversionOptimizerEligibility());
TestUtils.assertDeepReflectionEquals(this.campaign1, testCampaign1);
TestUtils.assertDeepReflectionEquals(this.campaign2, testCampaign2);
}