/**
* Test adding an campaign ad extension.
*/
public void testAdd() throws Exception {
// Create campaign ad extension.
CampaignAdExtension extension = new CampaignAdExtension();
extension.setCampaignId(campaignId);
extension.setAdExtension(adExtensionProvider()[0]);
extension.setStatus(CampaignAdExtensionStatus.ACTIVE);
// Create operations.
CampaignAdExtensionOperation operation = new CampaignAdExtensionOperation();
operation.setOperand(extension);
operation.setOperator(Operator.ADD);
CampaignAdExtensionOperation[] operations = new CampaignAdExtensionOperation[] {operation};
// Add campaign ad extension.
CampaignAdExtensionReturnValue result = service.mutate(operations);
CampaignAdExtension testExtension = result.getValue()[0];
// Exclude generated fields.
extension.getAdExtension().setId(testExtension.getAdExtension().getId());
extension.getAdExtension().setAdExtensionType(
testExtension.getAdExtension().getAdExtensionType());
((LocationExtension) extension.getAdExtension()).getAddress().setProvinceCode(
((LocationExtension) testExtension.getAdExtension()).getAddress().getProvinceCode());
((LocationExtension) extension.getAdExtension())
.setEncodedLocation(((LocationExtension) testExtension.getAdExtension())
.getEncodedLocation());
extension.setApprovalStatus(testExtension.getApprovalStatus());
TestUtils.assertDeepReflectionEquals(extension, testExtension);
}