use of org.jbehave.core.io.StoryFinder in project serenity-jbehave by serenity-bdd.
the class SerenityStories method storyPaths.
public List<String> storyPaths() {
Set<String> storyPaths = new HashSet<>();
List<String> pathExpressions = getStoryPathExpressions();
StoryFinder storyFinder = new StoryFinder();
for (String pathExpression : pathExpressions) {
if (absolutePath(pathExpression)) {
storyPaths.add(pathExpression);
}
for (URL classpathRootUrl : allClasspathRoots()) {
storyPaths.addAll(storyFinder.findPaths(classpathRootUrl, pathExpression, ""));
}
storyPaths = removeDuplicatesFrom(storyPaths);
storyPaths = pruneGivenStoriesFrom(storyPaths);
}
return sorted(storyPaths);
}
use of org.jbehave.core.io.StoryFinder in project jbehave-core by jbehave.
the class CoreAnnotatedEmbedder method run.
@Test
public void run() {
List<String> storyPaths = new StoryFinder().findPaths(codeLocationFromPath("../core/src/main/java"), "**/*.story", "**/examples_table_loaded*");
injectedEmbedder().runStoriesAsPaths(storyPaths);
}
use of org.jbehave.core.io.StoryFinder in project jbehave-core by jbehave.
the class EmbedderMojoBehaviour method shouldRunStoriesAsEmbeddables.
@Test
public void shouldRunStoriesAsEmbeddables() throws MojoExecutionException, MojoFailureException {
// Given
final EmbedderClassLoader classLoader = new EmbedderClassLoader(this.getClass().getClassLoader());
RunStoriesAsEmbeddables mojo = new RunStoriesAsEmbeddables() {
@Override
protected Embedder newEmbedder() {
return embedder;
}
@Override
protected EmbedderClassLoader classLoader() {
return classLoader;
}
};
String searchInDirectory = "src/test/java/";
mojo.sourceDirectory = searchInDirectory;
List<String> includes = asList("**/stories/*.java");
mojo.includes = includes;
List<String> excludes = asList();
mojo.excludes = excludes;
List<String> classNames = new StoryFinder().findClassNames(searchInDirectory, includes, excludes);
// When
mojo.execute();
// Then
verify(embedder).runAsEmbeddables(classNames);
}
use of org.jbehave.core.io.StoryFinder in project jbehave-core by jbehave.
the class EmbedderMojoBehaviour method shouldReportFailuresInMappingStoriesAsPaths.
@Test(expected = MojoFailureException.class)
public void shouldReportFailuresInMappingStoriesAsPaths() throws MojoExecutionException, MojoFailureException {
// Given
final EmbedderClassLoader classLoader = new EmbedderClassLoader(this.getClass().getClassLoader());
MapStoriesAsPaths mojo = new MapStoriesAsPaths() {
@Override
protected Embedder newEmbedder() {
return embedder;
}
@Override
protected EmbedderClassLoader classLoader() {
return classLoader;
}
};
String searchInDirectory = "src/test/java/";
mojo.sourceDirectory = searchInDirectory;
mojo.outputDirectory = "target/test-classes";
List<String> includes = asList("**/stories/*.story");
mojo.includes = includes;
List<String> excludes = asList();
mojo.excludes = excludes;
List<String> storyPaths = new StoryFinder().findPaths(searchInDirectory, includes, excludes);
// When
doThrow(new RuntimeException()).when(embedder).mapStoriesAsPaths(storyPaths);
mojo.execute();
// Then fail as expected
}
use of org.jbehave.core.io.StoryFinder in project jbehave-core by jbehave.
the class CoreEmbedderWithSpringJUnit4ClassRunner method runStoriesAsPaths.
@Test
public void runStoriesAsPaths() {
List<String> storyPaths = new StoryFinder().findPaths(codeLocationFromPath("../core/src/main/java"), "**/*.story", "");
embedder.runStoriesAsPaths(storyPaths);
}
Aggregations