/** * Dragon - SOA Governance Platform. * Copyright (c) 2009 EBM Websourcing, http://www.ebmwebsourcing.com/ * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * 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. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * ------------------------------------------------------------------------- * FileReaderUtilTest.java * ------------------------------------------------------------------------- */ package org.ow2.dragon.util; import java.io.InputStream; import java.util.List; import junit.framework.Assert; import org.apache.log4j.Logger; import org.junit.Test; import org.junit.internal.runners.JUnit4ClassRunner; import org.junit.runner.RunWith; /** * @author ofabre - ebmwebsourcing * */ @RunWith(JUnit4ClassRunner.class) public class FileReaderUtilTest extends Assert { private static Logger logger = Logger.getLogger(FileReaderUtilTest.class); @Test public void testReadLines() throws Exception { ClassLoader classLoader = FileReaderUtilTest.class.getClassLoader(); // Test on the same xml without comments InputStream fileToRead = classLoader.getResourceAsStream("categorization-types.txt"); // Try to read lines List lines = FileReaderUtil.readLines(fileToRead, ";"); assertNotNull(lines); assertTrue(lines.size()==26); for (String[] line : lines) { assertTrue(line.length==2); /*logger.info(line[0]); logger.info(line[1]);*/ } } }