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