public class TestUtils extends Object
| Modifier and Type | Field and Description |
|---|---|
static int |
BANNER_LENGTH |
static String |
BANNER_PADDING |
static @NotNull com.vladsch.flexmark.util.misc.CharPredicate |
CARET_PREDICATE |
static com.vladsch.flexmark.util.data.DataKey<BiFunction<String,String,com.vladsch.flexmark.util.data.DataHolder>> |
CUSTOM_OPTION |
static String |
DISABLED_OPTION_PREFIX |
static char |
DISABLED_OPTION_PREFIX_CHAR |
static com.vladsch.flexmark.util.data.DataKey<Boolean> |
EMBED_TIMED |
static String |
EMBED_TIMED_OPTION_NAME |
static int[] |
EMPTY_OFFSETS |
static com.vladsch.flexmark.util.data.DataKey<Boolean> |
FAIL |
static String |
FAIL_OPTION_NAME |
static String |
FILE_EOL_OPTION_NAME |
static String |
FILE_PROTOCOL |
static com.vladsch.flexmark.util.data.DataKey<Boolean> |
IGNORE |
static String |
IGNORE_OPTION_NAME |
static com.vladsch.flexmark.util.data.DataKey<String> |
INCLUDED_DOCUMENT |
static com.vladsch.flexmark.util.data.DataKey<Collection<com.vladsch.flexmark.util.misc.Extension>> |
LOAD_EXTENSIONS |
static String |
MARKUP_CARET |
static char |
MARKUP_CARET_CHAR |
static @NotNull com.vladsch.flexmark.util.misc.CharPredicate |
MARKUP_PREDICATE |
static String |
MARKUP_SELECTION_END |
static char |
MARKUP_SELECTION_END_CHAR |
static String |
MARKUP_SELECTION_START |
static char |
MARKUP_SELECTION_START_CHAR |
static com.vladsch.flexmark.util.data.DataKey<Boolean> |
NO_FILE_EOL |
static com.vladsch.flexmark.util.data.DataHolder |
NO_FILE_EOL_FALSE |
static String |
NO_FILE_EOL_OPTION_NAME |
static com.vladsch.flexmark.util.data.DataKey<String> |
SOURCE_INDENT |
static com.vladsch.flexmark.util.data.DataKey<String> |
SOURCE_PREFIX |
static com.vladsch.flexmark.util.data.DataKey<String> |
SOURCE_SUFFIX |
static com.vladsch.flexmark.util.data.DataKey<Boolean> |
TIMED |
static String |
TIMED_FORMAT_STRING |
static com.vladsch.flexmark.util.data.DataKey<Integer> |
TIMED_ITERATIONS |
static String |
TIMED_ITERATIONS_OPTION_NAME |
static String |
TIMED_OPTION_NAME |
static com.vladsch.flexmark.util.data.DataKey<Collection<Class<? extends com.vladsch.flexmark.util.misc.Extension>>> |
UNLOAD_EXTENSIONS |
| Constructor and Description |
|---|
TestUtils() |
| Modifier and Type | Method and Description |
|---|---|
static <T> com.vladsch.flexmark.util.data.MutableDataSet |
addOption(com.vladsch.flexmark.util.data.DataHolder options,
com.vladsch.flexmark.util.data.DataKey<T> key,
T value) |
static void |
addSpecExample(boolean useTestExample,
boolean includeExampleStart,
boolean toVisibleSpecText,
StringBuilder sb,
String source,
String html,
String ast,
String optionsSet,
boolean includeExampleCoords,
String section,
int number) |
static void |
addSpecExample(boolean includeExampleStart,
boolean toVisibleSpecText,
StringBuilder sb,
String source,
String html,
String ast,
String optionsSet,
boolean includeExampleCoords,
String section,
int number) |
static void |
addSpecExample(boolean includeExampleStart,
StringBuilder sb,
String source,
String html,
String ast,
String optionsSet,
boolean includeExampleCoords,
String section,
int number) |
static String |
addSpecExample(boolean includeExampleStart,
String source,
String html,
String ast,
String optionsSet) |
static void |
addSpecExample(CharSequence exampleBreak,
CharSequence sectionBreak,
boolean includeExampleStart,
boolean toVisibleSpecText,
Appendable out,
CharSequence source,
CharSequence html,
CharSequence ast,
CharSequence optionsSet,
boolean includeExampleCoords,
CharSequence section,
int number) |
static void |
addSpecExample(CharSequence exampleBreakOpen,
CharSequence htmlBreak,
CharSequence astBreak,
CharSequence exampleBreakClose,
boolean includeExampleStart,
boolean toVisibleSpecText,
Appendable out,
CharSequence source,
CharSequence html,
CharSequence ast,
CharSequence optionsSet,
boolean includeExampleCoords,
CharSequence section,
CharSequence number,
CharSequence exampleKeyword,
CharSequence optionsKeyword) |
static @NotNull com.vladsch.flexmark.util.misc.Pair<String,Integer> |
addSpecSection(@NotNull String headingLine,
@NotNull String headingText,
String[] sectionHeadings) |
static String |
adjustedFileUrl(@NotNull URL url) |
static void |
appendBanner(@NotNull StringBuilder out,
@NotNull String banner) |
static void |
appendBanner(@NotNull StringBuilder out,
@NotNull String banner,
boolean addBlankLine) |
static void |
appendBannerIfNeeded(@NotNull StringBuilder out,
@NotNull String banner) |
static @NotNull String |
ast(@NotNull com.vladsch.flexmark.util.ast.Node node) |
static @NotNull String |
bannerText(@NotNull String message) |
static <T> @NotNull HashMap<String,T> |
buildOptionsMap(boolean ensureAllBuiltInPresent,
@NotNull Object[][] options,
@NotNull BiFunction<ExampleOption,Object[],T> factory)
Build options map, optionally ensuring all built-ins are present
|
static <T> @NotNull HashMap<String,T> |
buildOptionsMap(@NotNull String[] options,
@NotNull BiFunction<ExampleOption,Integer,T> factory) |
static @Nullable com.vladsch.flexmark.util.data.DataHolder |
combineDefaultOptions(@Nullable com.vladsch.flexmark.util.data.DataHolder[] defaultOptions) |
static com.vladsch.flexmark.util.data.DataHolder |
customIntOption(@NotNull String option,
@Nullable String params,
@NotNull Function<Integer,com.vladsch.flexmark.util.data.DataHolder> resolver) |
static com.vladsch.flexmark.util.data.DataHolder |
customStringOption(@NotNull String option,
@Nullable String params,
@NotNull Function<String,com.vladsch.flexmark.util.data.DataHolder> resolver) |
static @Nullable com.vladsch.flexmark.util.data.DataHolder[] |
dataHolders(@Nullable com.vladsch.flexmark.util.data.DataHolder other,
@Nullable com.vladsch.flexmark.util.data.DataHolder[] overrides) |
static com.vladsch.flexmark.util.misc.Pair<com.vladsch.flexmark.util.sequence.BasedSequence,int[]> |
extractMarkup(com.vladsch.flexmark.util.sequence.BasedSequence input) |
static CharSequence |
fromVisibleSpecText(CharSequence s) |
static String |
fromVisibleSpecText(String s) |
static @NotNull String |
getAbsoluteSpecResourcePath(@NotNull String testClassPath,
@NotNull String resourceRootPath,
@NotNull String resourcePath) |
static @NotNull String |
getFormattedSection(String section,
int exampleNumber) |
static String |
getFormattedTimingInfo(int iterations,
long start,
long parse,
long render) |
static String |
getFormattedTimingInfo(String section,
int exampleNumber,
int iterations,
long start,
long parse,
long render) |
static com.vladsch.flexmark.util.data.DataHolder |
getOptions(@NotNull SpecExample example,
@Nullable String optionSets,
@NotNull Function<String,com.vladsch.flexmark.util.data.DataHolder> optionsProvider)
process comma separated list of option sets and combine them for final set to use
|
static @NotNull String |
getResolvedSpecResourcePath(@NotNull String testClassName,
@NotNull String resourcePath) |
static @NotNull String |
getRootDirectoryForModule(@NotNull Class<?> resourceClass,
@NotNull String moduleDirectoryName) |
static @NotNull String |
getSpecResourceFileUrl(@NotNull Class<?> resourceClass,
@NotNull String resourcePath) |
static ArrayList<Object[]> |
getTestData(@NotNull ResourceLocation location) |
static @NotNull String |
getTestResourceRootDirectoryForModule(@NotNull Class<?> resourceClass,
@NotNull String moduleRootPackage) |
static @NotNull String |
getUrlWithLineNumber(@NotNull String fileUrl,
int lineNumber) |
static com.vladsch.flexmark.util.sequence.builder.SequenceBuilder |
insertCaretMarkup(com.vladsch.flexmark.util.sequence.BasedSequence sequence,
int[] offsets) |
static @Nullable Map<String,? extends com.vladsch.flexmark.util.data.DataHolder> |
optionsMaps(@Nullable Map<String,? extends com.vladsch.flexmark.util.data.DataHolder> other,
@Nullable Map<String,? extends com.vladsch.flexmark.util.data.DataHolder> overrides) |
static com.vladsch.flexmark.util.data.DataHolder |
processOption(@NotNull Map<String,? extends com.vladsch.flexmark.util.data.DataHolder> optionsMap,
@NotNull String option) |
static String |
showTabs(String s)
Deprecated.
|
static com.vladsch.flexmark.util.sequence.BasedSequence |
stripIndent(com.vladsch.flexmark.util.sequence.BasedSequence input,
CharSequence sourceIndent) |
static void |
throwIgnoredOption(@NotNull SpecExample example,
@NotNull String optionSets,
@NotNull String option) |
static void |
throwIllegalStateException(@NotNull SpecExample example,
@NotNull String option) |
static CharSequence |
toVisibleSpecText(CharSequence s) |
static String |
toVisibleSpecText(String s) |
static String |
trimTrailingEOL(String parseSource) |
static String |
unShowTabs(String s)
Deprecated.
|
public static final char MARKUP_CARET_CHAR
public static final char MARKUP_SELECTION_START_CHAR
public static final char MARKUP_SELECTION_END_CHAR
public static final String MARKUP_CARET
public static final String MARKUP_SELECTION_START
public static final String MARKUP_SELECTION_END
@NotNull public static final @NotNull com.vladsch.flexmark.util.misc.CharPredicate CARET_PREDICATE
@NotNull public static final @NotNull com.vladsch.flexmark.util.misc.CharPredicate MARKUP_PREDICATE
public static final int[] EMPTY_OFFSETS
public static final char DISABLED_OPTION_PREFIX_CHAR
public static final String DISABLED_OPTION_PREFIX
public static final String EMBED_TIMED_OPTION_NAME
public static final String FAIL_OPTION_NAME
public static final String FILE_EOL_OPTION_NAME
public static final String IGNORE_OPTION_NAME
public static final String NO_FILE_EOL_OPTION_NAME
public static final String TIMED_ITERATIONS_OPTION_NAME
public static final String TIMED_OPTION_NAME
public static final com.vladsch.flexmark.util.data.DataKey<Boolean> EMBED_TIMED
public static final com.vladsch.flexmark.util.data.DataKey<Boolean> FAIL
public static final com.vladsch.flexmark.util.data.DataKey<Boolean> IGNORE
public static final com.vladsch.flexmark.util.data.DataKey<Boolean> NO_FILE_EOL
public static final com.vladsch.flexmark.util.data.DataKey<Boolean> TIMED
public static final com.vladsch.flexmark.util.data.DataKey<Integer> TIMED_ITERATIONS
public static final String TIMED_FORMAT_STRING
public static final com.vladsch.flexmark.util.data.DataKey<String> INCLUDED_DOCUMENT
public static final com.vladsch.flexmark.util.data.DataKey<String> SOURCE_PREFIX
public static final com.vladsch.flexmark.util.data.DataKey<String> SOURCE_SUFFIX
public static final com.vladsch.flexmark.util.data.DataKey<String> SOURCE_INDENT
public static final com.vladsch.flexmark.util.data.DataHolder NO_FILE_EOL_FALSE
public static final com.vladsch.flexmark.util.data.DataKey<Collection<Class<? extends com.vladsch.flexmark.util.misc.Extension>>> UNLOAD_EXTENSIONS
public static final com.vladsch.flexmark.util.data.DataKey<Collection<com.vladsch.flexmark.util.misc.Extension>> LOAD_EXTENSIONS
public static final com.vladsch.flexmark.util.data.DataKey<BiFunction<String,String,com.vladsch.flexmark.util.data.DataHolder>> CUSTOM_OPTION
public static final String FILE_PROTOCOL
public static final String BANNER_PADDING
public static final int BANNER_LENGTH
public static com.vladsch.flexmark.util.data.DataHolder processOption(@NotNull
@NotNull Map<String,? extends com.vladsch.flexmark.util.data.DataHolder> optionsMap,
@NotNull
@NotNull String option)
@NotNull public static <T> @NotNull HashMap<String,T> buildOptionsMap(@NotNull @NotNull String[] options, @NotNull @NotNull BiFunction<ExampleOption,Integer,T> factory)
@NotNull public static <T> @NotNull HashMap<String,T> buildOptionsMap(boolean ensureAllBuiltInPresent, @NotNull @NotNull Object[][] options, @NotNull @NotNull BiFunction<ExampleOption,Object[],T> factory)
T - type of value in the mapensureAllBuiltInPresent - if true, throws IllegalStateException if some built-in options are missingoptions - array of object arrays, each row represents option values
with first element ([0]) of each row being an option string.
Each row is passed to factory to allow creating custom options.factory - factory creating a type from ExampleOption and given row of parameters@NotNull public static @NotNull com.vladsch.flexmark.util.misc.Pair<String,Integer> addSpecSection(@NotNull @NotNull String headingLine, @NotNull @NotNull String headingText, String[] sectionHeadings)
public static com.vladsch.flexmark.util.data.DataHolder getOptions(@NotNull
@NotNull SpecExample example,
@Nullable
@Nullable String optionSets,
@NotNull
@NotNull Function<String,com.vladsch.flexmark.util.data.DataHolder> optionsProvider)
example - spec example instance for which options are being processedoptionSets - comma separate list of option set namesoptionsProvider - function to take a string option name and provide settings based on itpublic static <T> com.vladsch.flexmark.util.data.MutableDataSet addOption(com.vladsch.flexmark.util.data.DataHolder options,
com.vladsch.flexmark.util.data.DataKey<T> key,
T value)
public static void throwIllegalStateException(@NotNull
@NotNull SpecExample example,
@NotNull
@NotNull String option)
public static void throwIgnoredOption(@NotNull
@NotNull SpecExample example,
@NotNull
@NotNull String optionSets,
@NotNull
@NotNull String option)
@NotNull public static @NotNull String ast(@NotNull @NotNull com.vladsch.flexmark.util.ast.Node node)
public static com.vladsch.flexmark.util.sequence.BasedSequence stripIndent(com.vladsch.flexmark.util.sequence.BasedSequence input,
CharSequence sourceIndent)
public static String addSpecExample(boolean includeExampleStart, String source, String html, String ast, String optionsSet)
public static void addSpecExample(boolean includeExampleStart,
StringBuilder sb,
String source,
String html,
String ast,
String optionsSet,
boolean includeExampleCoords,
String section,
int number)
public static void addSpecExample(boolean includeExampleStart,
boolean toVisibleSpecText,
StringBuilder sb,
String source,
String html,
String ast,
String optionsSet,
boolean includeExampleCoords,
String section,
int number)
public static void addSpecExample(boolean useTestExample,
boolean includeExampleStart,
boolean toVisibleSpecText,
StringBuilder sb,
String source,
String html,
String ast,
String optionsSet,
boolean includeExampleCoords,
String section,
int number)
public static void addSpecExample(CharSequence exampleBreak, CharSequence sectionBreak, boolean includeExampleStart, boolean toVisibleSpecText, Appendable out, CharSequence source, CharSequence html, CharSequence ast, CharSequence optionsSet, boolean includeExampleCoords, CharSequence section, int number)
public static void addSpecExample(CharSequence exampleBreakOpen, CharSequence htmlBreak, CharSequence astBreak, CharSequence exampleBreakClose, boolean includeExampleStart, boolean toVisibleSpecText, Appendable out, CharSequence source, CharSequence html, CharSequence ast, CharSequence optionsSet, boolean includeExampleCoords, CharSequence section, CharSequence number, CharSequence exampleKeyword, CharSequence optionsKeyword)
@Deprecated public static String showTabs(String s)
toVisibleSpecText(String)s - text to convert to visible charspublic static String toVisibleSpecText(String s)
s - text to convert to visible charspublic static CharSequence toVisibleSpecText(CharSequence s)
s - text to convert to visible chars@Deprecated public static String unShowTabs(String s)
fromVisibleSpecText(String)s - text to convert to from visible chars to normalpublic static String fromVisibleSpecText(String s)
s - text to convert to from visible chars to normalpublic static CharSequence fromVisibleSpecText(CharSequence s)
s - text to convert to from visible chars to normalpublic static String getFormattedTimingInfo(int iterations, long start, long parse, long render)
public static String getFormattedTimingInfo(String section, int exampleNumber, int iterations, long start, long parse, long render)
@NotNull public static @NotNull String getFormattedSection(String section, int exampleNumber)
@NotNull public static @NotNull String getResolvedSpecResourcePath(@NotNull @NotNull String testClassName, @NotNull @NotNull String resourcePath)
@NotNull public static @NotNull String getAbsoluteSpecResourcePath(@NotNull @NotNull String testClassPath, @NotNull @NotNull String resourceRootPath, @NotNull @NotNull String resourcePath)
@NotNull public static @NotNull String getSpecResourceFileUrl(@NotNull @NotNull Class<?> resourceClass, @NotNull @NotNull String resourcePath)
public static ArrayList<Object[]> getTestData(@NotNull @NotNull ResourceLocation location)
@NotNull public static @NotNull String getUrlWithLineNumber(@NotNull @NotNull String fileUrl, int lineNumber)
@Nullable
public static @Nullable com.vladsch.flexmark.util.data.DataHolder combineDefaultOptions(@Nullable
@Nullable com.vladsch.flexmark.util.data.DataHolder[] defaultOptions)
@Nullable public static @Nullable Map<String,? extends com.vladsch.flexmark.util.data.DataHolder> optionsMaps(@Nullable @Nullable Map<String,? extends com.vladsch.flexmark.util.data.DataHolder> other, @Nullable @Nullable Map<String,? extends com.vladsch.flexmark.util.data.DataHolder> overrides)
@Nullable
public static @Nullable com.vladsch.flexmark.util.data.DataHolder[] dataHolders(@Nullable
@Nullable com.vladsch.flexmark.util.data.DataHolder other,
@Nullable
@Nullable com.vladsch.flexmark.util.data.DataHolder[] overrides)
@NotNull public static @NotNull String getTestResourceRootDirectoryForModule(@NotNull @NotNull Class<?> resourceClass, @NotNull @NotNull String moduleRootPackage)
@NotNull public static @NotNull String getRootDirectoryForModule(@NotNull @NotNull Class<?> resourceClass, @NotNull @NotNull String moduleDirectoryName)
public static com.vladsch.flexmark.util.data.DataHolder customStringOption(@NotNull
@NotNull String option,
@Nullable
@Nullable String params,
@NotNull
@NotNull Function<String,com.vladsch.flexmark.util.data.DataHolder> resolver)
public static com.vladsch.flexmark.util.data.DataHolder customIntOption(@NotNull
@NotNull String option,
@Nullable
@Nullable String params,
@NotNull
@NotNull Function<Integer,com.vladsch.flexmark.util.data.DataHolder> resolver)
public static com.vladsch.flexmark.util.sequence.builder.SequenceBuilder insertCaretMarkup(com.vladsch.flexmark.util.sequence.BasedSequence sequence,
int[] offsets)
public static com.vladsch.flexmark.util.misc.Pair<com.vladsch.flexmark.util.sequence.BasedSequence,int[]> extractMarkup(com.vladsch.flexmark.util.sequence.BasedSequence input)
public static void appendBanner(@NotNull
@NotNull StringBuilder out,
@NotNull
@NotNull String banner)
public static void appendBanner(@NotNull
@NotNull StringBuilder out,
@NotNull
@NotNull String banner,
boolean addBlankLine)
public static void appendBannerIfNeeded(@NotNull
@NotNull StringBuilder out,
@NotNull
@NotNull String banner)
Copyright © 2020. All rights reserved.