fixed unit test

This commit is contained in:
jomu
2014-11-07 15:33:40 +00:00
parent 70e324040e
commit 344d954abd

View File

@ -1,51 +1,52 @@
/* /*
* To change this template, choose Tools | Templates * To change this template, choose Tools | Templates
* and open the template in the editor. * and open the template in the editor.
*/ */
package de.muehlencord.shared.util.file; package de.muehlencord.shared.util.file;
import static de.muehlencord.shared.util.file.FileUtil.getFilesFromDirecotry; import static de.muehlencord.shared.util.file.FileUtil.getFilesFromDirecotry;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.net.URISyntaxException; import java.net.URISyntaxException;
import java.net.URL; import java.net.URL;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import org.junit.Ignore; import static org.junit.Assert.assertEquals;
import org.junit.Test; import org.junit.Ignore;
import org.junit.Test;
/**
* /**
* @author jomu *
*/ * @author jomu
public class FileUtilTest { */
public class FileUtilTest {
/**
* tests the function getFilesFromDirectory /**
* @throws FileHandlingException if the files could not be listed * tests the function getFilesFromDirectory
* @throws URISyntaxException if the testfile specification is wrong * @throws FileHandlingException if the files could not be listed
*/ * @throws URISyntaxException if the testfile specification is wrong
@Test */
@Ignore @Test
public void testGetFilesFromDirecotry() throws FileHandlingException, URISyntaxException { @Ignore
System.out.println("testGetFilesFromDirectory"); public void testGetFilesFromDirecotry() throws FileHandlingException, URISyntaxException {
System.out.println("testGetFilesFromDirectory");
URL url = getClass().getResource("testfile.txt");
File testFile = new File(url.getFile()); URL url = getClass().getResource("testfile.txt");
File testFile = new File(url.getFile());
List<File> fileList = getFilesFromDirecotry(testFile.getParent(), ".*.java");
Iterator<File> it = fileList.iterator(); List<File> fileList = getFilesFromDirecotry(testFile.getParent(), ".*.java");
while (it.hasNext()) { Iterator<File> it = fileList.iterator();
System.out.println(it.next()); while (it.hasNext()) {
} System.out.println(it.next());
} }
}
@Test
public void testMd5Sum() throws IOException, URISyntaxException { @Test
System.out.println("testGetFilesFromDirectory"); public void testMd5Sum() throws IOException, URISyntaxException {
URL url = getClass().getResource("testfile.txt"); System.out.println("testGetFilesFromDirectory");
File testFile = new File(url.getFile()); URL url = getClass().getResource("testfile.txt");
String fileName = testFile.toString(); File testFile = new File(url.getFile());
System.out.println (FileUtil.md5Sum(fileName)); String fileName = testFile.toString();
} System.out.println (FileUtil.md5Sum(fileName));
} }
}