Unit tests added for PackageHelper class.
Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/c1a599ec Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/c1a599ec Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/c1a599ec Branch: refs/heads/master Commit: c1a599ec92cbed2108f22f3d40adac6c6340f0d2 Parents: 90b2129 Author: nkukhar <kukha...@gmail.com> Authored: Mon Feb 9 23:44:25 2015 -0800 Committer: Claus Ibsen <davscl...@apache.org> Committed: Tue Feb 10 09:50:08 2015 +0100 ---------------------------------------------------------------------- .../apache/camel/maven/PackageHelperTest.java | 31 ++++++++++++++++++++ .../src/test/resources/filecontent/a.txt | 1 + .../src/test/resources/json/a.json | 0 .../src/test/resources/json/b.json | 0 .../src/test/resources/json/c.txt | 0 5 files changed, 32 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/c1a599ec/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/test/java/org/apache/camel/maven/PackageHelperTest.java ---------------------------------------------------------------------- diff --git a/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/test/java/org/apache/camel/maven/PackageHelperTest.java b/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/test/java/org/apache/camel/maven/PackageHelperTest.java new file mode 100644 index 0000000..5e6f6ad --- /dev/null +++ b/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/test/java/org/apache/camel/maven/PackageHelperTest.java @@ -0,0 +1,31 @@ +package org.apache.camel.maven; + +import org.junit.Assert; +import org.junit.Test; + +import java.io.File; +import java.util.Map; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + + +public class PackageHelperTest { + + @Test + public void testFileToString() throws Exception { + assertEquals("dk19i21)@+#(OR", PackageHelper.fileToString(new File( + this.getClass().getClassLoader().getResource("filecontent/a.txt").getFile()))); + } + + @Test + public void testFindJsonFiles() throws Exception { + Map<String, File> jsonFiles = PackageHelper.findJsonFiles(new File( + this.getClass().getClassLoader().getResource("json").getFile())); + + assertTrue("Files a.json must be found", jsonFiles.containsKey("a")); + assertTrue("Files b.json must be found", jsonFiles.containsKey("b")); + assertFalse("File c.txt must not be found", jsonFiles.containsKey("c")); + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/c1a599ec/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/test/resources/filecontent/a.txt ---------------------------------------------------------------------- diff --git a/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/test/resources/filecontent/a.txt b/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/test/resources/filecontent/a.txt new file mode 100644 index 0000000..5bed490 --- /dev/null +++ b/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/test/resources/filecontent/a.txt @@ -0,0 +1 @@ +dk19i21)@+#(OR \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/c1a599ec/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/test/resources/json/a.json ---------------------------------------------------------------------- diff --git a/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/test/resources/json/a.json b/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/test/resources/json/a.json new file mode 100644 index 0000000..e69de29 http://git-wip-us.apache.org/repos/asf/camel/blob/c1a599ec/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/test/resources/json/b.json ---------------------------------------------------------------------- diff --git a/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/test/resources/json/b.json b/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/test/resources/json/b.json new file mode 100644 index 0000000..e69de29 http://git-wip-us.apache.org/repos/asf/camel/blob/c1a599ec/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/test/resources/json/c.txt ---------------------------------------------------------------------- diff --git a/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/test/resources/json/c.txt b/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/test/resources/json/c.txt new file mode 100644 index 0000000..e69de29