Package com.android.testutils.truth
Class AbstractZipSubject<S extends com.google.common.truth.Subject<S,T>,T extends Zip>
- java.lang.Object
-
- com.google.common.truth.Subject<S,T>
-
- com.android.testutils.truth.AbstractZipSubject<S,T>
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable
- Direct Known Subclasses:
ZipFileSubject
public abstract class AbstractZipSubject<S extends com.google.common.truth.Subject<S,T>,T extends Zip> extends com.google.common.truth.Subject<S,T> implements java.io.CloseableTruth support for zip files.
-
-
Constructor Summary
Constructors Constructor Description AbstractZipSubject(com.google.common.truth.FailureMetadata failureMetadata, T subject)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidclose()abstract voidcontains(java.lang.String path)Asserts the zip file contains a file with the specified path.voidcontainsFileWithContent(java.lang.String path, byte[] content)Asserts the zip file contains a file with the specified byte array content.voidcontainsFileWithContent(java.lang.String path, java.lang.String content)Asserts the zip file contains a file with the specified String content.voidcontainsFileWithMatch(java.lang.String path, java.lang.String pattern)voidcontainsFileWithoutContent(java.lang.String path, java.lang.String sub)Asserts the zip file contains a file without the specified byte sequence anywhere in the fileabstract voiddoesNotContain(java.lang.String path)Asserts the zip file does not contains a file with the specified path.voiddoesNotExist()com.google.common.truth.IterableSubjectentries(java.lang.String conformingTo)Returns aIterableSubjectof all the Zip entries which name matches the passed regular expression.voidexists()protected byte[]extractContentAsBytes(java.lang.String path)protected java.lang.StringextractContentAsString(java.lang.String path)-
Methods inherited from class com.google.common.truth.Subject
actual, actualAsString, actualCustomStringRepresentation, check, check, equals, fail, fail, fail, failWithActual, failWithActual, failWithBadResults, failWithCustomSubject, failWithoutActual, failWithoutActual, failWithoutSubject, getSubject, hashCode, ignoreCheck, internalCustomName, isAnyOf, isEqualTo, isIn, isInstanceOf, isNoneOf, isNotEqualTo, isNotIn, isNotInstanceOf, isNotNull, isNotSameAs, isNotSameInstanceAs, isNull, isSameAs, isSameInstanceAs, named, toString
-
-
-
-
Constructor Detail
-
AbstractZipSubject
public AbstractZipSubject(@NonNull com.google.common.truth.FailureMetadata failureMetadata, @NonNull T subject)
-
-
Method Detail
-
contains
public abstract void contains(@NonNull java.lang.String path) throws java.io.IOExceptionAsserts the zip file contains a file with the specified path.- Throws:
java.io.IOException
-
doesNotContain
public abstract void doesNotContain(@NonNull java.lang.String path) throws java.io.IOExceptionAsserts the zip file does not contains a file with the specified path.- Throws:
java.io.IOException
-
entries
public final com.google.common.truth.IterableSubject entries(@NonNull java.lang.String conformingTo)Returns aIterableSubjectof all the Zip entries which name matches the passed regular expression.- Parameters:
conformingTo- a regular expression to match entries we are interested in.- Returns:
- a
IterableSubjectpropositions for matching entries.
-
containsFileWithContent
public final void containsFileWithContent(@NonNull java.lang.String path, @NonNull java.lang.String content)Asserts the zip file contains a file with the specified String content.Content is trimmed when compared.
-
containsFileWithMatch
public final void containsFileWithMatch(@NonNull java.lang.String path, @NonNull java.lang.String pattern)
-
containsFileWithContent
public final void containsFileWithContent(@NonNull java.lang.String path, @NonNull byte[] content)Asserts the zip file contains a file with the specified byte array content.
-
containsFileWithoutContent
public final void containsFileWithoutContent(@NonNull java.lang.String path, @NonNull java.lang.String sub)Asserts the zip file contains a file without the specified byte sequence anywhere in the file
-
exists
public final void exists()
-
doesNotExist
public final void doesNotExist()
-
close
public final void close()
- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable
-
extractContentAsString
protected final java.lang.String extractContentAsString(@NonNull java.lang.String path)
-
extractContentAsBytes
@Nullable protected final byte[] extractContentAsBytes(@NonNull java.lang.String path)
-
-