|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.sonatype.sisu.litmus.testsupport.hamcrest.FileMatchers
public class FileMatchers
Some ideas copied freely from http://www.time4tea.net/wiki/display/MAIN/Testing+Files+with+Hamcrest
Converted to pure Hamcrest
Constructor Summary | |
---|---|
FileMatchers()
|
Method Summary | |
---|---|
static org.hamcrest.Matcher<File> |
contains(String... entries)
|
static org.hamcrest.Matcher<ZipFile> |
containsEntry(String entryName)
|
static org.hamcrest.Matcher<File> |
containsOnly(String content)
Assert a file contains only the specified string content |
static org.hamcrest.Matcher<File> |
doesNotContain(String... entries)
|
static org.hamcrest.Matcher<File> |
exists()
|
static org.hamcrest.Matcher<File> |
isDirectory()
|
static org.hamcrest.Matcher<? super File> |
isEmpty()
|
static org.hamcrest.Matcher<File> |
isFile()
|
static org.hamcrest.Matcher<File> |
named(String name)
|
static org.hamcrest.Matcher<File> |
readable()
|
static String |
readFully(File file)
Read from file till EOF. |
static String |
readFully(Reader rdr)
Read from reader till EOF. |
static String |
readFully(Reader rdr,
int bufferSize)
Read from reader till EOF. |
static org.hamcrest.Matcher<File> |
sized(Long size)
|
static org.hamcrest.Matcher<File> |
sized(org.hamcrest.Matcher<Long> size)
|
static org.hamcrest.Matcher<File> |
withAbsolutePath(String path)
|
static org.hamcrest.Matcher<File> |
withCanonicalPath(String path)
|
static org.hamcrest.Matcher<File> |
writable()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public FileMatchers()
Method Detail |
---|
public static org.hamcrest.Matcher<File> isDirectory()
public static org.hamcrest.Matcher<File> exists()
public static org.hamcrest.Matcher<File> isFile()
public static org.hamcrest.Matcher<File> readable()
public static org.hamcrest.Matcher<File> writable()
public static org.hamcrest.Matcher<File> sized(Long size)
public static org.hamcrest.Matcher<File> sized(org.hamcrest.Matcher<Long> size)
public static org.hamcrest.Matcher<File> named(String name)
public static org.hamcrest.Matcher<File> withCanonicalPath(String path)
public static org.hamcrest.Matcher<File> withAbsolutePath(String path)
public static org.hamcrest.Matcher<File> contains(String... entries)
public static org.hamcrest.Matcher<File> containsOnly(String content)
public static org.hamcrest.Matcher<File> doesNotContain(String... entries)
public static org.hamcrest.Matcher<ZipFile> containsEntry(String entryName)
public static String readFully(File file) throws IOException
file
- the file from which to read
IOException
- if the contents could not be read out from the
reader.public static String readFully(Reader rdr) throws IOException
rdr
- the reader from which to read.
IOException
- if the contents could not be read out from the
reader.public static String readFully(Reader rdr, int bufferSize) throws IOException
rdr
- the reader from which to read.bufferSize
- the buffer size to use when reading.
IOException
- if the contents could not be read out from the
reader.public static org.hamcrest.Matcher<? super File> isEmpty()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |