Package org.jbehave.core.io
Class LoadFromRelativeFile
java.lang.Object
org.jbehave.core.io.LoadFromRelativeFile
- All Implemented Interfaces:
ResourceLoader
,StoryLoader
Loads story resources from relative file paths that are traversal to a given location.
StoryLoader loader = new LoadFromRelativeFile(codeLocationFromClass(YourStory.class));
By default, it uses traversal directory 'target/test-classes' with source dir in 'src/test/java'.
Other traversal locations can be specified via the varargs constructor:
StoryLoader loader = new LoadFromRelativeFile(codeLocationFromClass(YourStory.class),
mavenModuleTestStoryFilePath("src/test/java"), intellijProjectTestStoryFilePath("src/test/java"));
Convenience methods : mavenModuleStoryFilePath(java.lang.String)
,
mavenModuleTestStoryFilePath(java.lang.String)
, intellijProjectStoryFilePath(java.lang.String)
,
intellijProjectTestStoryFilePath(java.lang.String)
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
For use the the varargs constructor ofLoadFromRelativeFile
, to allow a range of possibilities for locating Story file paths -
Constructor Summary
ConstructorDescriptionLoadFromRelativeFile
(URL location) LoadFromRelativeFile
(URL location, Charset charset) LoadFromRelativeFile
(URL location, Charset charset, LoadFromRelativeFile.StoryFilePath... traversals) LoadFromRelativeFile
(URL location, LoadFromRelativeFile.StoryFilePath... traversals) -
Method Summary
Modifier and TypeMethodDescriptionintellijProjectStoryFilePath
(String relativePath) Intellij by default, has its PRODUCTION classes in classes/production.intellijProjectTestStoryFilePath
(String relativePath) Intellij by default, has its TEST classes in classes/test.protected String
loadContent
(String path) loadResourceAsText
(String resourcePath) loadStoryAsText
(String storyPath) mavenModuleStoryFilePath
(String relativePath) Maven by default, has its PRODUCTION classes in target/classes.mavenModuleTestStoryFilePath
(String relativePath) Maven by default, has its TEST classes in target/test-classes.
-
Constructor Details
-
LoadFromRelativeFile
-
LoadFromRelativeFile
-
LoadFromRelativeFile
-
LoadFromRelativeFile
public LoadFromRelativeFile(URL location, Charset charset, LoadFromRelativeFile.StoryFilePath... traversals)
-
-
Method Details
-
loadResourceAsText
- Specified by:
loadResourceAsText
in interfaceResourceLoader
-
loadStoryAsText
- Specified by:
loadStoryAsText
in interfaceStoryLoader
-
loadContent
-
mavenModuleStoryFilePath
Maven by default, has its PRODUCTION classes in target/classes. This story file path is relative to that.- Parameters:
relativePath
- the path to the stories' base-dir inside the module- Returns:
- the resulting StoryFilePath
-
mavenModuleTestStoryFilePath
Maven by default, has its TEST classes in target/test-classes. This story file path is relative to that.- Parameters:
relativePath
- the path to the stories' base-dir inside the module- Returns:
- the resulting StoryFilePath
-
intellijProjectStoryFilePath
Intellij by default, has its PRODUCTION classes in classes/production. This story file path is relative to that.- Parameters:
relativePath
- the path to the stories' base-dir inside the module- Returns:
- the resulting StoryFilePath
-
intellijProjectTestStoryFilePath
public static LoadFromRelativeFile.StoryFilePath intellijProjectTestStoryFilePath(String relativePath) Intellij by default, has its TEST classes in classes/test. This story file path is relative to that.- Parameters:
relativePath
- the path to the stories' base-dir inside the module- Returns:
- the resulting StoryFilePath
-