From fe696b6f703bca011168207faf87299ba13f0621 Mon Sep 17 00:00:00 2001 From: Nelson Tavares de Sousa <stu103017@mail.uni-kiel.de> Date: Mon, 27 Oct 2014 17:24:23 +0100 Subject: [PATCH] added tests which include PipeFactoryLoader --- conf/pipe-factories.conf | 2 +- .../java/teetime/framework/FileSearcherTest.java | 15 +++++++++++++-- src/test/resources/data/empty-test.conf | 0 3 files changed, 14 insertions(+), 3 deletions(-) create mode 100644 src/test/resources/data/empty-test.conf diff --git a/conf/pipe-factories.conf b/conf/pipe-factories.conf index 50f869a0..e3d966cf 100644 --- a/conf/pipe-factories.conf +++ b/conf/pipe-factories.conf @@ -1,4 +1,4 @@ teetime.framework.pipe.SingleElementPipeFactory teetime.framework.pipe.OrderedGrowableArrayPipeFactory teetime.framework.pipe.UnorderedGrowablePipeFactory -teetime.framework.pipe.SpScPipeFactory +teetime.framework.pipe.SpScPipeFactory \ No newline at end of file diff --git a/src/test/java/teetime/framework/FileSearcherTest.java b/src/test/java/teetime/framework/FileSearcherTest.java index 74c4b073..44729d09 100644 --- a/src/test/java/teetime/framework/FileSearcherTest.java +++ b/src/test/java/teetime/framework/FileSearcherTest.java @@ -10,11 +10,14 @@ import java.util.List; import org.junit.Assert; import org.junit.Test; +import teetime.framework.pipe.IPipeFactory; +import teetime.framework.pipe.PipeFactoryLoader; + public class FileSearcherTest { @Test public void fileInClasspath() throws IOException { - List<URL> list = FileSearcher.loadResources("data/input.txt"); + List<URL> list = FileSearcher.loadResources("pipe-factories.conf"); Assert.assertEquals(false, list.isEmpty()); } @@ -32,7 +35,15 @@ public class FileSearcherTest { @Test public void emptyConfig() throws IOException { - // List<IPipeFactory> list = PipeFactoryLoader.mergeConfigFiles(); + List<IPipeFactory> list = PipeFactoryLoader.mergeConfigFiles("data/empty-test.conf"); + Assert.assertEquals(true, list.isEmpty()); + } + + @Test + public void singleConfig() throws IOException { + List<IPipeFactory> list = PipeFactoryLoader.mergeConfigFiles("pipe-factories.conf"); + int lines = this.countLines(new File("conf/pipe-factories.conf")); + Assert.assertEquals(lines, list.size()); } private int countLines(final File fileName) throws IOException { diff --git a/src/test/resources/data/empty-test.conf b/src/test/resources/data/empty-test.conf new file mode 100644 index 00000000..e69de29b -- GitLab