commit b379d215a9404bae6d515e65909c28bac85f3a51 Author: Alex Lehmann <alexl...@gmail.com> AuthorDate: Sun Mar 11 23:20:57 2012 +0100 Commit: Alex Lehmann <alexl...@gmail.com> CommitDate: Sun Mar 11 23:20:57 2012 +0100
unit test to show decoding issue when the location contains a + char due to URLDecode.decode diff --git a/jbehave-core/src/test/java/org/jbehave/core/io/LoadFromRelativeFileTest.java b/jbehave-core/src/test/java/org/jbehave/core/io/LoadFromRelativeFileTest.java new file mode 100644 index 0000000..39c66a4 --- /dev/null +++ b/jbehave-core/src/test/java/org/jbehave/core/io/LoadFromRelativeFileTest.java @@ -0,0 +1,20 @@ +package org.jbehave.core.io; + +import java.net.MalformedURLException; +import java.net.URL; +import org.junit.*; +import static org.junit.Assert.*; +import static org.hamcrest.Matchers.*; + +public class LoadFromRelativeFileTest { + + @Test + public void testLoadFromRelativeFile() throws MalformedURLException { + URL baseLocation = CodeLocations.codeLocationFromClass(LoadFromRelativeFileTest.class); + URL subdir=new URL(baseLocation.toString()+"/test+dir"); + LoadFromRelativeFile load = new LoadFromRelativeFile(subdir); + String storyText=load.loadStoryAsText("dummy.story"); + assertThat(storyText, equalTo("dummy story file")); + } + +} diff --git a/jbehave-core/src/test/resources/test+dir/dummy.story b/jbehave-core/src/test/resources/test+dir/dummy.story new file mode 100644 index 0000000..42bc032 --- /dev/null +++ b/jbehave-core/src/test/resources/test+dir/dummy.story @@ -0,0 +1 @@ +dummy story file \ No newline at end of file