Package example

Source Code of example.SJTestimonialTest

/*
  Milyn - Copyright (C) 2006 - 2010

  This library is free software; you can redistribute it and/or
  modify it under the terms of the GNU Lesser General Public
  License (version 2.1) as published by the Free Software
  Foundation.

  This library is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

  See the GNU Lesser General Public License for more details:
  http://www.gnu.org/licenses/lgpl.txt
*/
package example;

import junit.framework.TestCase;
import org.xml.sax.SAXException;
import se.sj.ipl.rollingstock.domain.RollingStockList;

import java.io.IOException;
import java.util.Map;

/**
* @author <a href="mailto:tom.fennelly@gmail.com">tom.fennelly@gmail.com</a>
*/
public class SJTestimonialTest extends TestCase {

    public void test_dom() throws IOException, SAXException {
        test("smooks-config.xml");
    }

    public void test_sax() throws IOException, SAXException {
        test("smooks-config-sax.xml");
    }

    private void test(String config) throws IOException, SAXException {
        Map beans = Main.runSmooksTransform(config);
        RollingStockList rollingstocks = (RollingStockList) beans.get("rollingstocks");

        // Just some really basic checks
        assertEquals(3, rollingstocks.size());
        assertEquals(1, rollingstocks.get(0).getVehicles().size());
        assertEquals(2, rollingstocks.get(1).getVehicles().size());
        assertEquals(1, rollingstocks.get(2).getVehicles().size());
        assertEquals(1, rollingstocks.get(2).getVehicles().get(0).getComments().size());
    }
}
TOP

Related Classes of example.SJTestimonialTest

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.