Package com.google.checkout.orderprocessing

Source Code of com.google.checkout.orderprocessing.UnarchiveOrderRequestTest

/*******************************************************************************
* Copyright (C) 2007 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
******************************************************************************/

package com.google.checkout.orderprocessing;

import org.custommonkey.xmlunit.Validator;
import org.custommonkey.xmlunit.XMLTestCase;
import org.custommonkey.xmlunit.XMLUnit;
import org.xml.sax.SAXNotRecognizedException;

import com.google.checkout.MerchantConstants;

public final class UnarchiveOrderRequestTest extends XMLTestCase {

  String xsd = "http://code.google.com/apis/checkout/apiv2.xsd";

  MerchantConstants dummyMerchantConstants;

  public UnarchiveOrderRequestTest(String name) {
    super(name);
  }

  public void setUp() throws Exception {

    dummyMerchantConstants = new MerchantConstants("", "", "", "USD", "",
        "", "");

    XMLUnit.setIgnoreWhitespace(true);
    XMLUnit.setIgnoreDiffBetweenTextAndCDATA(true);
    XMLUnit.setIgnoreComments(true);
  }

  public void testRequest() throws Exception {

    AddMerchantOrderNumberRequest request = new AddMerchantOrderNumberRequest(
        dummyMerchantConstants);
    request.setGoogleOrderNo("1234567890");
    request.setMerchantOrderNo("0987654321");

    try {
      Validator v = new Validator(request.getXml());
      v.useXMLSchema(true);
      v.setJAXP12SchemaSource(xsd);

      assertTrue("XML valid ", v.isValid());
    } catch (SAXNotRecognizedException e) {
      System.out.println("Parser does not support validation.");
    }
  }
}
TOP

Related Classes of com.google.checkout.orderprocessing.UnarchiveOrderRequestTest

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.