Search in sources :

Example 1 with CriterionError

use of com.google.api.ads.adwords.jaxws.v201809.cm.CriterionError in project googleads-java-lib by googleads.

the class JaxWsBatchJobResponseDeserializerTest method testDeserializeBatchJobMutateResponseWithErrors.

@Test
public void testDeserializeBatchJobMutateResponseWithErrors() throws Exception {
    BatchJobMutateResponse response = deserializer.deserializeBatchJobMutateResults(BatchJobMutateResponse.class, JaxWsBatchJobResponseDeserializerTest.class.getResource("resources/BatchJobMutate.responseWithErrors.xml"));
    assertNotNull("Null deserialized request returned", response);
    // Expect: Campaign, AdGroup, BiddableAdGroupCriterion, BiddableAdGroupCriterion,
    // CriterionError, CriterionError, CriterionError
    assertEquals(7, response.getMutateResults().length);
    assertNotNull(response.getMutateResults()[0].getOperand().getCampaign());
    assertNotNull(response.getMutateResults()[1].getOperand().getAdGroup());
    assertNotNull(response.getMutateResults()[2].getOperand().getAdGroupCriterion());
    assertThat(response.getMutateResults()[2].getOperand().getAdGroupCriterion(), Matchers.instanceOf(BiddableAdGroupCriterion.class));
    assertNotNull(response.getMutateResults()[3].getOperand().getAdGroupCriterion());
    assertThat(response.getMutateResults()[3].getOperand().getAdGroupCriterion(), Matchers.instanceOf(BiddableAdGroupCriterion.class));
    assertThat(response.getMutateResults()[4].getErrorList().getErrors()[0], Matchers.instanceOf(CriterionError.class));
    assertThat(response.getMutateResults()[5].getErrorList().getErrors()[0], Matchers.instanceOf(CriterionError.class));
    assertThat(response.getMutateResults()[6].getErrorList().getErrors()[0], Matchers.instanceOf(CriterionError.class));
}
Also used : BatchJobMutateResponse(com.google.api.ads.adwords.jaxws.utils.v201809.batchjob.BatchJobMutateResponse) BiddableAdGroupCriterion(com.google.api.ads.adwords.jaxws.v201809.cm.BiddableAdGroupCriterion) CriterionError(com.google.api.ads.adwords.jaxws.v201809.cm.CriterionError) Test(org.junit.Test)

Example 2 with CriterionError

use of com.google.api.ads.adwords.jaxws.v201809.cm.CriterionError in project googleads-java-lib by googleads.

the class JaxWsDeserializationTest method testDeserializeBatchJobMutateRequest.

@Test
public void testDeserializeBatchJobMutateRequest() {
    Source source = new StreamSource(JaxWsDeserializationTest.class.getResourceAsStream("resources/BatchJobMutate.responseWithErrors.xml"));
    BatchJobMutateResponse response = deserializer.deserialize(source);
    assertNotNull("Null deserialized request returned", response);
    // Expect: Campaign, AdGroup, BiddableAdGroupCriterion, BiddableAdGroupCriterion,
    // CriterionError, CriterionError, CriterionError
    assertEquals(7, response.getMutateResults().length);
    assertNotNull(response.getMutateResults()[0].getOperand().getCampaign());
    assertNotNull(response.getMutateResults()[1].getOperand().getAdGroup());
    assertNotNull(response.getMutateResults()[2].getOperand().getAdGroupCriterion());
    assertThat(response.getMutateResults()[2].getOperand().getAdGroupCriterion(), Matchers.instanceOf(BiddableAdGroupCriterion.class));
    assertNotNull(response.getMutateResults()[3].getOperand().getAdGroupCriterion());
    assertThat(response.getMutateResults()[3].getOperand().getAdGroupCriterion(), Matchers.instanceOf(BiddableAdGroupCriterion.class));
    assertThat(response.getMutateResults()[4].getErrorList().getErrors()[0], Matchers.instanceOf(CriterionError.class));
    assertThat(response.getMutateResults()[5].getErrorList().getErrors()[0], Matchers.instanceOf(CriterionError.class));
    assertThat(response.getMutateResults()[6].getErrorList().getErrors()[0], Matchers.instanceOf(CriterionError.class));
}
Also used : BatchJobMutateResponse(com.google.api.ads.adwords.jaxws.utils.v201809.batchjob.BatchJobMutateResponse) BiddableAdGroupCriterion(com.google.api.ads.adwords.jaxws.v201809.cm.BiddableAdGroupCriterion) StreamSource(javax.xml.transform.stream.StreamSource) CriterionError(com.google.api.ads.adwords.jaxws.v201809.cm.CriterionError) StreamSource(javax.xml.transform.stream.StreamSource) Source(javax.xml.transform.Source) Test(org.junit.Test)

Aggregations

BatchJobMutateResponse (com.google.api.ads.adwords.jaxws.utils.v201809.batchjob.BatchJobMutateResponse)2 BiddableAdGroupCriterion (com.google.api.ads.adwords.jaxws.v201809.cm.BiddableAdGroupCriterion)2 CriterionError (com.google.api.ads.adwords.jaxws.v201809.cm.CriterionError)2 Test (org.junit.Test)2 Source (javax.xml.transform.Source)1 StreamSource (javax.xml.transform.stream.StreamSource)1