1 /* 2 * #%L 3 * IsisFish 4 * 5 * $Id: IsisFishMiscTest.java 4156 2014-12-09 11:27:18Z echatellier $ 6 * $HeadURL: https://svn.codelutin.com/isis-fish/tags/isis-fish-4.4.0.2/src/test/java/fr/ifremer/isisfish/IsisFishMiscTest.java $ 7 * %% 8 * Copyright (C) 2009 - 2010 Ifremer, Code Lutin 9 * %% 10 * This program is free software: you can redistribute it and/or modify 11 * it under the terms of the GNU General Public License as 12 * published by the Free Software Foundation, either version 3 of the 13 * License, or (at your option) any later version. 14 * 15 * This program is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU General Public License for more details. 19 * 20 * You should have received a copy of the GNU General Public 21 * License along with this program. If not, see 22 * <http://www.gnu.org/licenses/gpl-3.0.html>. 23 * #L% 24 */ 25 26 package fr.ifremer.isisfish; 27 28 import java.io.File; 29 import java.io.IOException; 30 31 import org.apache.commons.io.FileUtils; 32 import org.junit.Assert; 33 import org.junit.Test; 34 35 /** 36 * Misc test on isis config. 37 * 38 * @author chatellier 39 * @version $Revision: 4156 $ 40 * 41 * Last update : $Date: 2014-12-09 12:27:18 +0100 (Tue, 09 Dec 2014) $ 42 * By : $Author: echatellier $ 43 */ 44 public class IsisFishMiscTest { 45 46 /** 47 * Test that go.bat file in clrf valid for windows. 48 * 49 * If this test fail, use unix2dos command on unix. 50 * 51 * @throws IOException 52 */ 53 @Test 54 public void testCRLFOnBat() throws IOException { 55 File batFile = new File("src" + File.separator + "main" + File.separator + "assembly" + File.separator + "isisfish.bat"); 56 batFile = batFile.getAbsoluteFile(); // for maven 57 58 String content = FileUtils.readFileToString(batFile); 59 System.out.println(content); 60 String[] lines = content.split("\n"); 61 62 // -1, last line have no \r 63 for (int index = 0 ; index < lines.length - 1; ++ index) { 64 Assert.assertTrue("File is not valide for Windows on line " + index, lines[index].endsWith("\r")); 65 } 66 } 67 }