/* Copyright 2009 Christopher Evans cevans42ca at yahoo.ca This file is part of the JCommons project, available at: http://sourceforge.net/projects/jcommons/ JCommons is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. JCommons 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 General Public License for more details. You should have received a copy of the GNU General Public License along with JCommons; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ package ca.quine.jcommons.sourceexporter.test; import java.io.File; import java.util.ArrayList; import java.util.List; import ca.quine.jcommons.sourceexporter.SourceExporter; import junitx.framework.FileAssert; public class ListExportTest extends SourceExporterTestCase { public void testListOfString() throws Exception { SourceExporter sourceExporter = new SourceExporter(); File tempFile = File.createTempFile("Source-Export-List-Of-String", ".java"); tempFile.deleteOnExit(); List listOfString = new ArrayList(); listOfString.add("1"); listOfString.add("2"); listOfString.add("3"); sourceExporter.export(tempFile.getAbsolutePath(), RESOURCES_PACKAGE, "CreateListOfString", "java.util.List", "createList", listOfString); FileAssert.assertEquals(new File(TEST_DIR + "CreateListOfString.java"), tempFile); } public void testListOfInt() throws Exception { SourceExporter sourceExporter = new SourceExporter(); File tempFile = File.createTempFile("Source-Export-List-Of-Int", ".java"); tempFile.deleteOnExit(); List listOfInt = new ArrayList(); listOfInt.add(new Integer(1)); listOfInt.add(new Integer(2)); listOfInt.add(new Integer(3)); sourceExporter.export(tempFile.getAbsolutePath(), RESOURCES_PACKAGE, "CreateListOfInt", "java.util.List", "createList", listOfInt); FileAssert.assertEquals(new File(TEST_DIR + "CreateListOfInt.java"), tempFile); } public void testListOfNodes() throws Exception { SourceExporter sourceExporter = new SourceExporter(); File tempFile = File.createTempFile("Source-Export-List-Of-Nodes", ".java"); tempFile.deleteOnExit(); List listOfString = new ArrayList(); listOfString.add(new Node("First Node")); listOfString.add(new Node("Second Node")); listOfString.add(new Node("Third Node")); sourceExporter.export(tempFile.getAbsolutePath(), RESOURCES_PACKAGE, "CreateListOfNodes", "java.util.List", "createList", listOfString); FileAssert.assertEquals(new File(TEST_DIR + "CreateListOfNodes.java"), tempFile); } }