Class TextFileMatchers
java.lang.Object
org.glassfish.tests.utils.junit.matcher.TextFileMatchers
Matchers for text files.
- Author:
- David Matejcek
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> org.hamcrest.Matcher<File>getterMatches(Function<File, T> fileGetter, org.hamcrest.Matcher<T> expected) Creates a matcher for matching some file feature.static org.hamcrest.Matcher<File>hasLineCount(long expected, Charset charset) Creates a matcher for matching file's line count.static org.hamcrest.Matcher<File>hasLineCount(org.hamcrest.Matcher<Long> expected, Charset charset) Creates a matcher for matching file's line count.
-
Constructor Details
-
TextFileMatchers
public TextFileMatchers()
-
-
Method Details
-
hasLineCount
Creates a matcher for matching file's line count. File encoding.hsould be known or expected at least.- Parameters:
expected- expected number of lines.charset- the file encoding- Returns:
- generated matcher.
-
hasLineCount
public static org.hamcrest.Matcher<File> hasLineCount(org.hamcrest.Matcher<Long> expected, Charset charset) Creates a matcher for matching file's line count. File encoding.hsould be known or expected at least.- Parameters:
expected-Matcherfor expected number of lines.charset- the file encoding- Returns:
- generated matcher.
-
getterMatches
public static <T> org.hamcrest.Matcher<File> getterMatches(Function<File, T> fileGetter, org.hamcrest.Matcher<T> expected) Creates a matcher for matching some file feature.- Type Parameters:
T- Type of the file's feature- Parameters:
fileGetter- Converter ofFileinstance toTtype.expected-MatcherforTinstance obtained from thefileGetter.- Returns:
- generated matcher.
-