public final class JavaFileObjectSubject
extends com.google.common.truth.Subject
JavaFileObjects.| Modifier and Type | Method and Description |
|---|---|
protected String |
actualCustomStringRepresentation() |
static JavaFileObjectSubject |
assertThat(JavaFileObject actual)
Starts making assertions about a
JavaFileObject. |
void |
containsElementsIn(JavaFileObject expectedPattern)
Asserts that the every node in the AST of
expectedPattern
exists in the actual file's AST, in the same order. |
com.google.common.truth.StringSubject |
contentsAsString(Charset charset)
Returns a
StringSubject that makes assertions about the contents of the actual file as
a string. |
com.google.common.truth.StringSubject |
contentsAsUtf8String()
Returns a
StringSubject that makes assertions about the contents of the actual file as
a UTF-8 string. |
void |
hasContents(com.google.common.io.ByteSource expected)
Asserts that the actual file's contents are equal to
expected. |
void |
hasSourceEquivalentTo(JavaFileObject expectedSource)
Asserts that the actual file is a source file that has an equivalent AST to that of
expectedSource. |
void |
isEqualTo(Object other)
If
other is a JavaFileObject, tests that their contents are equal. |
static com.google.common.truth.Subject.Factory<JavaFileObjectSubject,JavaFileObject> |
javaFileObjects()
Returns a
Subject.Factory for JavaFileObjectSubjects. |
public static com.google.common.truth.Subject.Factory<JavaFileObjectSubject,JavaFileObject> javaFileObjects()
Subject.Factory for JavaFileObjectSubjects.public static JavaFileObjectSubject assertThat(JavaFileObject actual)
JavaFileObject.protected String actualCustomStringRepresentation()
actualCustomStringRepresentation in class com.google.common.truth.Subjectpublic void isEqualTo(@Nullable Object other)
other is a JavaFileObject, tests that their contents are equal. Otherwise
uses Object.equals(Object).isEqualTo in class com.google.common.truth.Subjectpublic void hasContents(com.google.common.io.ByteSource expected)
expected.public com.google.common.truth.StringSubject contentsAsString(Charset charset)
StringSubject that makes assertions about the contents of the actual file as
a string.public com.google.common.truth.StringSubject contentsAsUtf8String()
StringSubject that makes assertions about the contents of the actual file as
a UTF-8 string.public void hasSourceEquivalentTo(JavaFileObject expectedSource)
expectedSource.public void containsElementsIn(JavaFileObject expectedPattern)
expectedPattern
exists in the actual file's AST, in the same order.
Methods, constructors, fields, and types that are in the pattern must have the exact same
modifiers and annotations as the actual AST. Ordering of AST nodes is also important (i.e. a
type with identical members in a different order will fail the assertion). Types must match the
entire type declaration: type parameters, extends/implements clauses, etc.
Methods must also match the throws clause as well.
The body of a method or constructor, or field initializer in the actual AST must match the pattern in entirety if the member is present in the pattern.
Said in another way (from a graph-theoretic perspective): the pattern AST must be a subgraph of the actual AST. If a method, constructor, or field is in the pattern, that entire subtree, including modifiers and annotations, must be equal to the corresponding subtree in the actual AST (no proper subgraphs).
Copyright © 2013–2020. All rights reserved.