Package eu.planets_project.pp.plato.test.controller

Source Code of eu.planets_project.pp.plato.test.controller.ProjectExporterUnitTest

/*******************************************************************************
* Copyright (c) 2006-2010 Vienna University of Technology,
* Department of Software Technology and Interactive Systems
*
* All rights reserved. This program and the accompanying
* materials are made available under the terms of the
* Apache License, Version 2.0 which accompanies
* this distribution, and is available at
* http://www.apache.org/licenses/LICENSE-2.0
*******************************************************************************/

package eu.planets_project.pp.plato.test.controller;

import java.io.ByteArrayOutputStream;

import org.dom4j.io.XMLWriter;
import org.testng.annotations.Test;

import eu.planets_project.pp.plato.model.Plan;
import eu.planets_project.pp.plato.xml.ProjectExporter;

public class ProjectExporterUnitTest {

    @Test
    public void testPlainExport() throws Exception {
        ProjectExporter exporter = new ProjectExporter();

        String s = exporter.exportToString(TestProjectFactory.createMinimalistTestProject());

        Plan q = TestProjectFactory.createMinimalistTestProject();

        ByteArrayOutputStream buffer = new ByteArrayOutputStream();
        XMLWriter writer = new XMLWriter(buffer, ProjectExporter.prettyFormat);

        assert writer != null;

        writer.write(exporter.exportToXml(q));
        writer.close();
        assert s.equals(buffer.toString());
    }

}
TOP

Related Classes of eu.planets_project.pp.plato.test.controller.ProjectExporterUnitTest

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.