Skip to content
Snippets Groups Projects
Commit 99288bea authored by Nelson Tavares de Sousa's avatar Nelson Tavares de Sousa
Browse files

first version of FileSearcherTest

updated buildpath to include all files in src/test/resources
parent 142235cd
No related branches found
No related tags found
No related merge requests found
......@@ -24,7 +24,7 @@
</attributes>
</classpathentry>
<classpathentry including="**/*.java" kind="src" path="src/main/resources"/>
<classpathentry including="**/*.java" kind="src" path="src/test/resources"/>
<classpathentry kind="src" path="src/test/resources"/>
<classpathentry kind="src" path="conf"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>
package teetime.framework;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.net.URL;
import java.util.List;
import org.junit.Assert;
import org.junit.Test;
public class FileSearcherTest {
@Test
public void fileInClasspath() throws IOException {
List<URL> list = FileSearcher.loadResources("data/input.txt");
Assert.assertEquals(false, list.isEmpty());
}
@Test
public void multipleFiles() throws IOException {
List<URL> list = FileSearcher.loadResources("LICENSE.txt");
Assert.assertEquals(true, list.size() > 1);
}
@Test
public void missingFile() throws IOException {
List<URL> list = FileSearcher.loadResources("filethatdoesnotexistinanyproject.nope");
Assert.assertEquals(true, list.isEmpty());
}
@Test
public void emptyConfig() throws IOException {
// List<IPipeFactory> list = PipeFactoryLoader.mergeConfigFiles();
}
private int countLines(final File fileName) throws IOException {
BufferedReader r = new BufferedReader(new FileReader(fileName));
int lines = 0;
while (r.readLine() != null) {
lines++;
}
r.close();
return lines;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment