org.jbehave.core.io
Class LoadFromRelativeFile

java.lang.Object
  extended by org.jbehave.core.io.LoadFromRelativeFile
All Implemented Interfaces:
StoryLoader

public class LoadFromRelativeFile
extends java.lang.Object
implements StoryLoader

Defaults to working from classes compiled to Maven-style 'target/test-classes', with story source in 'src/test/java' LoadFromRelativeFile loader = new LoadFromRelativeFile(codeLocationFromClass(YourStory.class)); To work with something other than the default story locations, you will have to specify them in 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) See also StoryLocation#codeLocationFromClass


Nested Class Summary
static class LoadFromRelativeFile.StoryFilePath
          For use the the varargs constructor of LoadFromRelativeFile, to allow a range of possibilities for locating Story file paths
 
Constructor Summary
LoadFromRelativeFile(java.net.URL location)
           
LoadFromRelativeFile(java.net.URL location, LoadFromRelativeFile.StoryFilePath... traversals)
           
 
Method Summary
static LoadFromRelativeFile.StoryFilePath intellijProjectStoryFilePath(java.lang.String relativePath)
          Intellij by default, has its PRODUCTION classes in classes/production.
static LoadFromRelativeFile.StoryFilePath intellijProjectTestStoryFilePath(java.lang.String relativePath)
          Intellij by default, has its TEST classes in classes/test.
protected  java.lang.String loadContent(java.lang.String path)
           
 java.lang.String loadStoryAsText(java.lang.String storyPath)
           
static LoadFromRelativeFile.StoryFilePath mavenModuleStoryFilePath(java.lang.String relativePath)
          Maven by default, has its PRODUCTION classes in target/classes.
static LoadFromRelativeFile.StoryFilePath mavenModuleTestStoryFilePath(java.lang.String relativePath)
          Maven by default, has its TEST classes in target/test-classes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LoadFromRelativeFile

public LoadFromRelativeFile(java.net.URL location)

LoadFromRelativeFile

public LoadFromRelativeFile(java.net.URL location,
                            LoadFromRelativeFile.StoryFilePath... traversals)
Method Detail

loadStoryAsText

public java.lang.String loadStoryAsText(java.lang.String storyPath)
Specified by:
loadStoryAsText in interface StoryLoader

loadContent

protected java.lang.String loadContent(java.lang.String path)

mavenModuleStoryFilePath

public static LoadFromRelativeFile.StoryFilePath mavenModuleStoryFilePath(java.lang.String relativePath)
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

public static LoadFromRelativeFile.StoryFilePath mavenModuleTestStoryFilePath(java.lang.String relativePath)
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

public static LoadFromRelativeFile.StoryFilePath intellijProjectStoryFilePath(java.lang.String relativePath)
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(java.lang.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


Copyright © 2003-2010. All Rights Reserved.