public abstract class AbstractZipSubject<T extends com.google.common.truth.Subject<T,java.io.File>>
extends com.google.common.truth.Subject<T,java.io.File>
| Modifier and Type | Class and Description |
|---|---|
static interface |
AbstractZipSubject.ZipEntryAction<T>
Perform an action on a Zip file entry.
|
| Constructor and Description |
|---|
AbstractZipSubject(com.google.common.truth.FailureStrategy failureStrategy,
java.io.File subject) |
| Modifier and Type | Method and Description |
|---|---|
void |
contains(java.lang.String path)
Asserts the zip file contains a file with the specified path.
|
void |
containsFileWithContent(java.lang.String path,
byte[] content)
Asserts the zip file contains a file with the specified byte array content.
|
void |
containsFileWithContent(java.lang.String path,
java.lang.String content)
Asserts the zip file contains a file with the specified String content.
|
void |
containsFileWithMatch(java.lang.String path,
java.lang.String pattern) |
void |
containsFileWithoutContent(java.lang.String path,
java.lang.String sub)
Asserts the zip file contains a file without the specified byte sequence
anywhere in the file
|
void |
doesNotContain(java.lang.String path)
Asserts the zip file does not contains a file with the specified path.
|
com.google.common.truth.IterableSubject<? extends com.google.common.truth.IterableSubject<?,java.lang.String,java.util.List<java.lang.String>>,java.lang.String,java.util.List<java.lang.String>> |
entries(java.lang.String conformingTo)
Returns a
IterableSubject of all the Zip entries which name matches the passed
regular expression. |
protected byte[] |
extractContentAsByte(java.lang.String path) |
protected java.lang.String |
extractContentAsString(java.lang.String path) |
protected <T> T |
extractEntryAndRunAction(java.lang.String path,
AbstractZipSubject.ZipEntryAction<T> action)
Convenience method to extract an entry from the current zip file, and run a
AbstractZipSubject.ZipEntryAction on it. |
protected java.io.InputStream |
getInputStream(java.util.zip.ZipFile zip,
java.lang.String path) |
check, equals, fail, fail, fail, failWithBadResults, failWithCustomSubject, failWithoutSubject, failWithRawMessage, getDisplaySubject, getSubject, hashCode, internalCustomName, isAnyOf, isEqualTo, isIn, isInstanceOf, isNoneOf, isNotEqualTo, isNotIn, isNotInstanceOf, isNotNull, isNotSameAs, isNull, isSameAs, namedpublic AbstractZipSubject(@NonNull
com.google.common.truth.FailureStrategy failureStrategy,
@NonNull
java.io.File subject)
public void contains(@NonNull
java.lang.String path)
throws java.io.IOException
java.io.IOExceptionpublic void doesNotContain(@NonNull
java.lang.String path)
throws java.io.IOException
java.io.IOExceptionpublic com.google.common.truth.IterableSubject<? extends com.google.common.truth.IterableSubject<?,java.lang.String,java.util.List<java.lang.String>>,java.lang.String,java.util.List<java.lang.String>> entries(@NonNull
java.lang.String conformingTo)
throws java.io.IOException
IterableSubject of all the Zip entries which name matches the passed
regular expression.conformingTo - a regular expression to match entries we are interested in.IterableSubject propositions for matching entries.java.io.IOException - of the zip file cannot be opened.public void containsFileWithContent(@NonNull
java.lang.String path,
@NonNull
java.lang.String content)
public void containsFileWithMatch(@NonNull
java.lang.String path,
@NonNull
java.lang.String pattern)
public void containsFileWithContent(@NonNull
java.lang.String path,
@NonNull
byte[] content)
public void containsFileWithoutContent(@NonNull
java.lang.String path,
@NonNull
java.lang.String sub)
protected java.lang.String extractContentAsString(@NonNull
java.lang.String path)
@Nullable
protected byte[] extractContentAsByte(@NonNull
java.lang.String path)
protected java.io.InputStream getInputStream(@NonNull
java.util.zip.ZipFile zip,
@NonNull
java.lang.String path)
@Nullable
protected <T> T extractEntryAndRunAction(@NonNull
java.lang.String path,
@NonNull
AbstractZipSubject.ZipEntryAction<T> action)
throws java.io.IOException
AbstractZipSubject.ZipEntryAction on it.T - the expected result typepath - the entry name in the subject's zip.action - the action to run on the extracted entry.java.io.IOException