use of org.jbehave.core.io.StoryFinder in project jbehave-core by jbehave.
the class EmbedderTaskBehaviour method shouldMapStoriesAsPaths.
@Test
public void shouldMapStoriesAsPaths() {
// Given
final EmbedderClassLoader classLoader = new EmbedderClassLoader(this.getClass().getClassLoader());
MapStoriesAsPaths task = new MapStoriesAsPaths() {
@Override
protected Embedder newEmbedder() {
return embedder;
}
@Override
protected EmbedderClassLoader classLoader() {
return classLoader;
}
};
String searchInDirectory = "src/test/java/";
task.setSourceDirectory(searchInDirectory);
List<String> includes = asList("**/stories/*.story");
task.setIncludes(StringUtils.join(includes, "'"));
List<String> excludes = asList();
task.setExcludes(StringUtils.join(excludes, "'"));
List<String> storyPaths = new StoryFinder().findPaths(searchInDirectory, includes, excludes);
// When
task.execute();
// Then
verify(embedder).mapStoriesAsPaths(storyPaths);
}
use of org.jbehave.core.io.StoryFinder in project jbehave-core by jbehave.
the class EmbedderTaskBehaviour method shouldAllowSpecificationOfStoryFinderClass.
@Test
public void shouldAllowSpecificationOfStoryFinderClass() {
// Given
AbstractEmbedderTask task = new AbstractEmbedderTask() {
};
// When
task.setStoryFinderClass(MyStoryFinder.class.getName());
StoryFinder storyFinder = task.newStoryFinder();
// Then
assertThat(storyFinder.getClass().getName(), equalTo(MyStoryFinder.class.getName()));
}
use of org.jbehave.core.io.StoryFinder in project jbehave-core by jbehave.
the class EmbedderTaskBehaviour method shouldRunStoriesAsEmbeddables.
@Test
public void shouldRunStoriesAsEmbeddables() {
// Given
final EmbedderClassLoader classLoader = new EmbedderClassLoader(this.getClass().getClassLoader());
RunStoriesAsEmbeddables task = new RunStoriesAsEmbeddables() {
@Override
protected Embedder newEmbedder() {
return embedder;
}
@Override
protected EmbedderClassLoader classLoader() {
return classLoader;
}
};
String searchInDirectory = "src/test/java/";
task.setSourceDirectory(searchInDirectory);
List<String> includes = asList("**/stories/*.java");
task.setIncludes(StringUtils.join(includes, "'"));
List<String> excludes = asList();
task.setExcludes(StringUtils.join(excludes, "'"));
List<String> classNames = new StoryFinder().findClassNames(searchInDirectory, includes, excludes);
// When
task.execute();
// Then
verify(embedder).runAsEmbeddables(classNames);
}
use of org.jbehave.core.io.StoryFinder in project jbehave-core by jbehave.
the class IndexWithBreadcrumbs method createIndexFromPaths.
protected Map<String, Resource> createIndexFromPaths(String rootURI, String rootPath, String syntax, String includes) {
Map<String, Resource> index = new HashMap<>();
List<String> paths = new StoryFinder().findPaths(codeLocationFromPath(rootPath), includes, EMPTY);
for (String path : paths) {
addPath(rootURI, rootPath, fullPath(rootPath, path), syntax, index);
}
return index;
}
use of org.jbehave.core.io.StoryFinder in project jbehave-core by jbehave.
the class CoreStoryRunner method mapStories.
@Test
public void mapStories() {
Embedder embedder = new Embedder();
embedder.useMetaFilters(asList("+author *", "+theme *", "-skip"));
List<String> storyPaths = new StoryFinder().findPaths(codeLocationFromClass(this.getClass()), "**/*.story", "");
embedder.mapStoriesAsPaths(storyPaths);
}
Aggregations