Skip to content

Commit

Permalink
update UT for version 12.0.4
Browse files Browse the repository at this point in the history
  • Loading branch information
qitia committed Mar 19, 2019
1 parent f25a088 commit 6b89059
Show file tree
Hide file tree
Showing 26 changed files with 120 additions and 102 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ public abstract class BulkActionAdExtensionTest extends BulkEntityTest<BulkActio

@Override
protected void onEntityCreation(BulkActionAdExtension entity) {
entity.setActionAdExtension(new ActionAdExtension());
ActionAdExtension e = new ActionAdExtension();
e.setId(100L);
entity.setActionAdExtension(e);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package com.microsoft.bingads.v12.api.test.entities.ad_extension.action.read;

import java.util.Arrays;
import java.util.Collection;

import org.junit.Test;
import org.junit.runners.Parameterized.Parameter;
import org.junit.runners.Parameterized.Parameters;

import com.microsoft.bingads.internal.functionalinterfaces.Function;
import com.microsoft.bingads.v12.api.test.entities.ad_extension.action.BulkActionAdExtensionTest;
import com.microsoft.bingads.v12.bulk.entities.BulkActionAdExtension;

public class BulkActionAdExtensionReadFromRowValuesActionTextTest extends BulkActionAdExtensionTest {

@Parameter(value = 1)
public String expectedResult;

@Parameters
public static Collection<Object[]> data() {
return Arrays.asList(new Object[][]{
{"Action Text", "Action Text"},
{null, null}
});
}

@Test
public void testRead() {
this.testReadProperty("Action Text", this.datum, this.expectedResult, new Function<BulkActionAdExtension, String>() {
@Override
public String apply(BulkActionAdExtension c) {
return c.getActionText();
}
});
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package com.microsoft.bingads.v12.api.test.entities.ad_extension.action.write;

import java.util.Arrays;
import java.util.Collection;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameter;
import org.junit.runners.Parameterized.Parameters;

import com.microsoft.bingads.internal.functionalinterfaces.BiConsumer;
import com.microsoft.bingads.v12.api.test.entities.ad_extension.action.BulkActionAdExtensionTest;
import com.microsoft.bingads.v12.bulk.entities.BulkActionAdExtension;

@RunWith(Parameterized.class)
public class BulkActionAdExtensionWriteToValuesActionTextTest extends BulkActionAdExtensionTest {

@Parameter(value = 1)
public String propertyValue;

@Parameters
public static Collection<Object[]> data() {
// In this example, the parameter generator returns a List of
// arrays. Each array has two elements: { datum, expected }.
// These data are hard-coded into the class, but they could be
// generated or loaded in any way you like.
return Arrays.asList(new Object[][]{
{"Action Text", "Action Text"},
{null, null},});
}

@Test
public void testWrite() {
this.<String>testWriteProperty("Action Text", this.datum, this.propertyValue, new BiConsumer<BulkActionAdExtension, String>() {
@Override
public void accept(BulkActionAdExtension c, String v) {
c.setActionText(v);
}
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ public abstract class BulkAppAdExtensionTest extends BulkEntityTest<BulkAppAdExt

@Override
protected void onEntityCreation(BulkAppAdExtension entity) {
entity.setAppAdExtension(new AppAdExtension());
AppAdExtension e = new AppAdExtension();
e.setId(100L);
entity.setAppAdExtension(e);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public static Collection<Object[]> data() {
return Arrays.asList(new Object[][]{
{"true", true},
{"false", false},
{"delete_value", null}
{"false", null}
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public static Collection<Object[]> data() {

return Arrays.asList(new Object[][] {
{null, null},
{"delete_value", new ArrayOflong()},
{null, new ArrayOflong()},
{"123;456", array},
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ public abstract class BulkSitelinkAdExtensionTest extends BulkEntityTest<BulkSit

@Override
protected void onEntityCreation(BulkSitelinkAdExtension entity) {
entity.setSitelinkAdExtension(new SitelinkAdExtension());
SitelinkAdExtension e = new SitelinkAdExtension();
e.setId(100L);
entity.setSitelinkAdExtension(e);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ protected void onEntityCreation(BulkAdGroupDynamicSearchAdTarget entity) {
webpage.setType("Webpage");

BiddableAdGroupCriterion biddableAdGroupCriterion = new BiddableAdGroupCriterion();
biddableAdGroupCriterion.setId(100L);
biddableAdGroupCriterion.setCriterion(webpage);

entity.setBiddableAdGroupCriterion(biddableAdGroupCriterion);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ public void accept(BulkAdGroupDynamicSearchAdTarget c, String v) {
Webpage criterion = new Webpage();

BiddableAdGroupCriterion adGroupCriterion = new BiddableAdGroupCriterion();

adGroupCriterion.setCriterion(criterion);

adGroupCriterion.setId(100L);
c.setBiddableAdGroupCriterion(adGroupCriterion);

adGroupCriterion.setTrackingUrlTemplate(v);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ protected void onEntityCreation(BulkAdGroupNegativeDynamicSearchAdTarget entity)

NegativeAdGroupCriterion negativeAdGroupCriterion = new NegativeAdGroupCriterion();
negativeAdGroupCriterion.setCriterion(webpage);

negativeAdGroupCriterion.setId(100L);
entity.setNegativeAdGroupCriterion(negativeAdGroupCriterion);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public abstract class BulkAdGroupProductPartitionTest extends BulkEntityTest<Bul

@Override
protected void onEntityCreation(BulkAdGroupProductPartition entity) {

int i =0;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public void accept(BulkAdGroupProductPartition c, FixedBid v) {
ProductPartition criterion = new ProductPartition();

BiddableAdGroupCriterion adGroupCriterion = new BiddableAdGroupCriterion();

adGroupCriterion.setId(100L);
adGroupCriterion.setCriterion(criterion);

c.setAdGroupCriterion(adGroupCriterion);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public void accept(BulkAdGroupProductPartition c, String v) {
BiddableAdGroupCriterion adGroupCriterion = new BiddableAdGroupCriterion();

adGroupCriterion.setCriterion(criterion);

adGroupCriterion.setId(100L);
c.setAdGroupCriterion(adGroupCriterion);

adGroupCriterion.setDestinationUrl(v);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public void accept(BulkAdGroupProductPartition c, ArrayOfstring v) {
ProductPartition criterion = new ProductPartition();

BiddableAdGroupCriterion adGroupCriterion = new BiddableAdGroupCriterion();

adGroupCriterion.setId(100L);
adGroupCriterion.setCriterion(criterion);

c.setAdGroupCriterion(adGroupCriterion);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public void accept(BulkAdGroupProductPartition c, ArrayOfstring v) {

BiddableAdGroupCriterion adGroupCriterion = new BiddableAdGroupCriterion();

adGroupCriterion.setId(100L);
adGroupCriterion.setCriterion(criterion);

c.setAdGroupCriterion(adGroupCriterion);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public void accept(BulkAdGroupProductPartition c, String v) {
BiddableAdGroupCriterion adGroupCriterion = new BiddableAdGroupCriterion();

adGroupCriterion.setCriterion(criterion);

adGroupCriterion.setId(100L);
c.setAdGroupCriterion(adGroupCriterion);

adGroupCriterion.setTrackingUrlTemplate(v);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ public abstract class BulkAdGroupTest extends BulkEntityTest<BulkAdGroup> {

@Override
protected void onEntityCreation(BulkAdGroup entity) {
entity.setAdGroup(new AdGroup());
AdGroup adGroup = new AdGroup();
adGroup.setId(100L);
entity.setAdGroup(adGroup);
}

@Override
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ public abstract class BulkAppInstallAdTest extends BulkEntityTest<BulkAppInstall

@Override
protected void onEntityCreation(BulkAppInstallAd entity) {
entity.setAppInstallAd(new AppInstallAd());
AppInstallAd ad = new AppInstallAd();
ad.setId(100L);
entity.setAppInstallAd(ad);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,16 @@
import com.microsoft.bingads.internal.functionalinterfaces.Supplier;
import com.microsoft.bingads.v12.api.test.entities.BulkEntityTest;
import com.microsoft.bingads.v12.bulk.entities.BulkExpandedTextAd;
import com.microsoft.bingads.v12.campaignmanagement.Ad;
import com.microsoft.bingads.v12.campaignmanagement.ExpandedTextAd;

public abstract class BulkExpandedTextAdTest extends BulkEntityTest<BulkExpandedTextAd> {

@Override
protected void onEntityCreation(BulkExpandedTextAd entity) {
entity.setExpandedTextAd(new ExpandedTextAd());
ExpandedTextAd e = new ExpandedTextAd();
e.setId(100L);
entity.setExpandedTextAd(e);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ public abstract class BulkTextAdTest extends BulkEntityTest<BulkTextAd> {

@Override
protected void onEntityCreation(BulkTextAd entity) {
entity.setTextAd(new TextAd());
TextAd e = new TextAd();
e.setId(100L);
entity.setTextAd(e);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ public abstract class BulkCampaignTest extends BulkEntityTest<BulkCampaign> {

@Override
protected void onEntityCreation(BulkCampaign entity) {
entity.setCampaign(new Campaign());
Campaign c = new Campaign();
c.setId(100L);
entity.setCampaign(c);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ protected void onEntityCreation(BulkCampaignNegativeDynamicSearchAdTarget entity

NegativeCampaignCriterion negativeCampaignCriterion = new NegativeCampaignCriterion();
negativeCampaignCriterion.setCriterion(webpage);
negativeCampaignCriterion.setId(100L);
negativeCampaignCriterion.setType("NegativeCampaignCriterion");

entity.setNegativeCampaignCriterion(negativeCampaignCriterion);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public static Collection<Object[]> data() {
// generated or loaded in any way you like.
return Arrays.asList(new Object[][]{
{"Test Experiment Status", "Test Experiment Status"},
{"delete_value", ""},
{"", ""},
{null, null},});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ public abstract class BulkKeywordTest extends BulkEntityTest<BulkKeyword> {

@Override
protected void onEntityCreation(BulkKeyword entity) {
entity.setKeyword(new Keyword());
Keyword e = new Keyword();
e.setId(100L);
entity.setKeyword(e);
}

@Override
Expand Down

0 comments on commit 6b89059

Please sign in to comment.