Package org.jbehave.core.io
Class StoryFinder
java.lang.Object
org.jbehave.core.io.StoryFinder
Finds stories by scanning source paths, which can be either filesystem directories or jars. Jars are identified by paths ending in ".jar".
Stories can be either in the form of class names or story paths.
The default class name extension is ".java".
Stories can be sorted by providing a sorting Comparator
.
Alternatively, stories can be sorted at execution-time using the
Configuration.useStoryExecutionComparator(Comparator)
instead.
-
Constructor Summary
ConstructorDescriptionCreates default StoryFinder for ".java" class names and no sorting.StoryFinder
(String classNameExtension) Creates a StoryFinder with a given class name extension and no sorting.StoryFinder
(Comparator<? super String> sortingComparator) Creates a StoryFinder with a given sorting comparator. -
Method Summary
Modifier and TypeMethodDescriptionprotected String
classNames
(List<String> paths) Finds Java classes from a source path, allowing for includes/excludes, and converts them to class names.Finds paths from a source path, allowing for include/exclude patterns.Finds paths from a source path, allowing for include/exclude patterns, which can be comma-separated values of multiple patterns.Finds paths from a source path, allowing for include/exclude patterns.Finds paths from a source path, allowing for includes/excludes.Finds paths from a source URL, allowing for includes/excludes patterns.Finds paths from a source URL, allowing for single include/exclude pattern.Finds paths from a source URL, allowing for includes/excludes patterns.protected Comparator<? super String>
Comparator used for sorting.
-
Constructor Details
-
StoryFinder
public StoryFinder()Creates default StoryFinder for ".java" class names and no sorting. -
StoryFinder
Creates a StoryFinder with a given class name extension and no sorting.- Parameters:
classNameExtension
- the extension
-
StoryFinder
Creates a StoryFinder with a given sorting comparator.- Parameters:
sortingComparator
- comparator to sort stories by path
-
-
Method Details
-
findClassNames
Finds Java classes from a source path, allowing for includes/excludes, and converts them to class names.- Parameters:
searchIn
- the path to search inincludes
- the List of include patterns, ornull
if noneexcludes
- the List of exclude patterns, ornull
if none- Returns:
- A List of class names found
-
findPaths
Finds paths from a source URL, allowing for single include/exclude pattern. Paths found are normalised bynormalise(List)
.- Parameters:
searchIn
- the source URL to search ininclude
- the include pattern, or""
if noneexclude
- the exclude pattern, or""
if none- Returns:
- A List of paths found
-
findPaths
Finds paths from a source URL, allowing for includes/excludes patterns. Paths found are normalised bynormalise(List)
.- Parameters:
searchIn
- the source URL to search inincludes
- the Array of include patterns, ornull
if noneexcludes
- the Array of exclude patterns, ornull
if none- Returns:
- A List of paths found
-
findPaths
Finds paths from a source path, allowing for include/exclude patterns, which can be comma-separated values of multiple patterns. Paths found are normalised bynormalise(List)
.- Parameters:
searchIn
- the source path to search ininclude
- the CSV include pattern, ornull
if noneexclude
- the CSV exclude pattern, ornull
if none- Returns:
- A List of paths found
-
findPaths
Finds paths from a source path, allowing for include/exclude patterns. Paths found are normalised bynormalise(List)
.- Parameters:
searchIn
- the source path to search inincludes
- the Array of include patterns, ornull
if noneexcludes
- the Array of exclude patterns, ornull
if none- Returns:
- A List of paths found
-
findPaths
Finds paths from a source URL, allowing for includes/excludes patterns. Paths found are normalised bynormalise(List)
.- Parameters:
searchIn
- the source URL to search inincludes
- the List of include patterns, ornull
if noneexcludes
- the List of exclude patterns, ornull
if none- Returns:
- A List of paths found
-
findPaths
Finds paths from a source path, allowing for include/exclude patterns. Paths found are normalised bynormalise(List)
. .- Parameters:
searchIn
- the source path to search inincludes
- the List of include patterns, ornull
if noneexcludes
- the List of exclude patterns, ornull
if none- Returns:
- A List of paths found
-
findPaths
public List<String> findPaths(String searchIn, List<String> includes, List<String> excludes, String prefixWith) Finds paths from a source path, allowing for includes/excludes. Paths found are prefixed with specified path byprefix(String, List)
and normalised bynormalise(List)
.- Parameters:
searchIn
- the source path to search inincludes
- the List of include patterns, ornull
if noneexcludes
- the List of exclude patterns, ornull
if noneprefixWith
- the root path prefixed to all paths found, ornull
if none- Returns:
- A List of paths found
-
normalise
-
prefix
-
classNames
-
classNameExtension
-
sort
-
sortingComparator
Comparator used for sorting. Anull
comparator means thatCollections.sort(List)
will use natural ordering.- Returns:
- A Comparator or
null
for natural ordering.
-
scan
-
scanJar
-