public class LithoViewAssert
extends <any>
LithoView
s.
To create an instance of this class, invoke
.
assertThat(LithoView)
Alternatively, use LegacyLithoAssertions
which provides entry points to all Litho
AssertJ helpers.
Modifier and Type | Class and Description |
---|---|
static class |
LithoViewAssert.OccurrenceCount |
Modifier and Type | Method and Description |
---|---|
static LithoViewAssert |
assertThat(LithoView actual) |
LithoViewAssert |
containsComponents(<any>... clazz)
Assert that the LithoView under test has the provided Component classes in the Component Tree
hierarchy
|
LithoViewAssert |
containsComponents(java.lang.Class<? extends Component>... clazz)
Assert that the LithoView under test has the provided Component classes in the Component Tree
hierarchy
|
LithoViewAssert |
containsDirectComponents(<any>... kClazzes)
Assert that the LithoView has a direct component of type clazz
|
LithoViewAssert |
containsExactly(int times,
<any> clazz)
Assert that the LithoView under test has the provided Component class in the Component Tree
hierarchy given number of times
|
LithoViewAssert |
containsExactly(int times,
java.lang.Class<? extends Component> clazz)
Assert that the LithoView under test has the provided Component class in the Component Tree
hierarchy given number of times
|
LithoViewAssert |
containsExactlyOne(<any> clazz)
Assert that the LithoView under test has the provided Component class once in the Component
Tree hierarchy.
|
LithoViewAssert |
containsExactlyOne(java.lang.Class<? extends Component> clazz)
Assert that the LithoView under test has the provided Component class once in the Component
Tree hierarchy.
|
LithoViewAssert |
containsTestKey(java.lang.String testKey) |
LithoViewAssert |
containsTestKey(java.lang.String testKey,
LithoViewAssert.OccurrenceCount count) |
LithoViewAssert |
doesNotContainComponents(<any>... clazz)
Assert that the LithoView under test does not contain the provided Component classes in the
Component Tree hierarchy
|
LithoViewAssert |
doesNotContainComponents(java.lang.Class<? extends Component>... clazz)
Assert that the LithoView under test does not contain the provided Component classes in the
Component Tree hierarchy
|
LithoViewAssert |
doesNotContainDirectComponents(<any>... kClazzes)
Assert that the LithoView does not have a direct component of type clazz
|
LithoViewAssert |
doesNotContainTestKey(java.lang.String testKey) |
LithoViewAssert |
doesNotHaveVisibleDrawable(Drawable drawable)
Inverse of
hasVisibleDrawable(Drawable) |
LithoViewAssert |
doesNotHaveVisibleText(int resourceId)
Inverse of
hasVisibleText(int) |
LithoViewAssert |
doesNotHaveVisibleText(java.lang.String text)
Inverse of
hasVisibleText(String) |
LithoViewAssert |
doesNotHaveVisibleTextContaining(java.lang.String text)
Inverse of
hasVisibleTextContaining(String) . |
LithoViewAssert |
doesNotHaveVisibleTextMatching(java.lang.String pattern)
Inverse of
hasVisibleTextMatching(String) . |
LithoViewAssert |
hasAnyMatchingComponent(<any> condition)
Asserts that the LithoView contains a Component satisfying the given condition at any level of
the hierarchy
|
<T1,T2> LithoViewAssert |
hasAnyMatchingComponent(KClass kClass,
<any>... propsValuePairs)
Asserts that the LithoView contains a Component with given props at any level of the hierarchy.
|
<T2,T1> LithoViewAssert |
hasAnyMatchingComponentWithMatcher(KClass kClass,
<any>... propsMatcherPairs)
Asserts that the LithoView contains a Component with props that matches given matcher at any
level of the hierarchy
|
LithoViewAssert |
hasContentDescription(int resourceId)
Assert that any view in the given Component has the provided content description.
|
LithoViewAssert |
hasContentDescription(java.lang.String contentDescription)
Assert that any view in the given Component has the provided content description.
|
LithoViewAssert |
hasDirectMatchingComponent(<any> condition)
Asserts that the LithoView will render Component as a direct children of the root satisfying
the given condition.
|
<T1,T2> LithoViewAssert |
hasDirectMatchingComponent(KClass kClass,
<any>... propsValuePairs)
Asserts that the LithoView contains a direct Component with given props
|
<T2,T1> LithoViewAssert |
hasDirectMatchingComponentWithMatcher(KClass kClass,
<any>... propsMatcherPairs)
Asserts that the LithoView contains a Component with props that matches given matcher at any
level of the hierarchy
|
LithoViewAssert |
hasMeasuredHeightOf(int height)
Assert that the LithoView under test has the provided measured height.
|
LithoViewAssert |
hasMeasuredWidthOf(int width)
Assert that the LithoView under test has the provided measured width.
|
LithoViewAssert |
hasViewTag(int tagId,
java.lang.Object tagValue)
Assert that the view tag is present for the given index.
|
LithoViewAssert |
hasVisibleDrawable(Drawable drawable)
Assert that the given component contains the drawable provided.
|
LithoViewAssert |
hasVisibleDrawable(int drawableRes)
Assert that the given component contains the drawable identified by the provided drawable
resource id.
|
LithoViewAssert |
hasVisibleText(int resourceId)
Assert that the given component has the exact text identified by resource id.
|
LithoViewAssert |
hasVisibleText(java.lang.String text)
Assert that the given component has the exact text provided.
|
LithoViewAssert |
hasVisibleTextContaining(java.lang.String text)
Assert that the given component contains the provided text.
|
LithoViewAssert |
hasVisibleTextMatching(java.lang.String pattern)
Assert that the given component contains the provided pattern.
|
static LithoViewAssert.OccurrenceCount |
once() |
static LithoViewAssert.OccurrenceCount |
times(int i) |
LithoViewAssert |
willNotRenderContent()
Assert that the LithoView will not render content, the root component will either return null
or a child with width and height equal to 0
|
LithoViewAssert |
willRenderContent()
Assert that the LithoView will render content, the root component won't return null nor a child
with height and width equal to 0
|
public static LithoViewAssert assertThat(LithoView actual)
public LithoViewAssert containsTestKey(java.lang.String testKey)
public LithoViewAssert containsTestKey(java.lang.String testKey, LithoViewAssert.OccurrenceCount count)
public LithoViewAssert doesNotContainTestKey(java.lang.String testKey)
public LithoViewAssert hasContentDescription(java.lang.String contentDescription)
public LithoViewAssert hasContentDescription(int resourceId)
public LithoViewAssert hasVisibleDrawable(int drawableRes)
public LithoViewAssert hasVisibleDrawable(Drawable drawable)
public LithoViewAssert doesNotHaveVisibleDrawable(Drawable drawable)
hasVisibleDrawable(Drawable)
public LithoViewAssert hasVisibleText(java.lang.String text)
public LithoViewAssert hasVisibleText(int resourceId)
public LithoViewAssert doesNotHaveVisibleText(java.lang.String text)
hasVisibleText(String)
public LithoViewAssert doesNotHaveVisibleText(int resourceId)
hasVisibleText(int)
public LithoViewAssert hasVisibleTextMatching(java.lang.String pattern)
public LithoViewAssert hasVisibleTextContaining(java.lang.String text)
public LithoViewAssert doesNotHaveVisibleTextMatching(java.lang.String pattern)
hasVisibleTextMatching(String)
.public LithoViewAssert doesNotHaveVisibleTextContaining(java.lang.String text)
hasVisibleTextContaining(String)
.public LithoViewAssert hasMeasuredWidthOf(int width)
public LithoViewAssert hasMeasuredHeightOf(int height)
public LithoViewAssert hasViewTag(int tagId, java.lang.Object tagValue)
tagId
- Index of the view tag.tagValue
- View tag value.public LithoViewAssert containsDirectComponents(<any>... kClazzes)
public LithoViewAssert doesNotContainDirectComponents(<any>... kClazzes)
public LithoViewAssert containsExactlyOne(java.lang.Class<? extends Component> clazz)
public LithoViewAssert containsExactly(int times, java.lang.Class<? extends Component> clazz)
public LithoViewAssert containsExactlyOne(<any> clazz)
public LithoViewAssert containsExactly(int times, <any> clazz)
public LithoViewAssert containsComponents(java.lang.Class<? extends Component>... clazz)
public LithoViewAssert containsComponents(<any>... clazz)
public LithoViewAssert doesNotContainComponents(java.lang.Class<? extends Component>... clazz)
public LithoViewAssert doesNotContainComponents(<any>... clazz)
public LithoViewAssert willRenderContent()
public LithoViewAssert willNotRenderContent()
public LithoViewAssert hasDirectMatchingComponent(<any> condition)
example:
FBStory -> Story -> Column -- StoryDescription -> Column ---- Text -- Text -- Comments -> Column ---- Text ---- TextEach row here is a single Node and the arrow indicates 'returns from render'. Direct children for FBStory Component is Story only and direct components for StoryDescription and Comments Components are Columns
public LithoViewAssert hasAnyMatchingComponent(<any> condition)
public <T1,T2> LithoViewAssert hasAnyMatchingComponent(KClass kClass, <any>... propsValuePairs)
kClass
- class of a componentpropsValuePairs
- Pairs of props and their expected valuespublic <T1,T2> LithoViewAssert hasDirectMatchingComponent(KClass kClass, <any>... propsValuePairs)
kClass
- class of a componentpropsValuePairs
- Pairs of props and their expected valuespublic <T2,T1> LithoViewAssert hasAnyMatchingComponentWithMatcher(KClass kClass, <any>... propsMatcherPairs)
kClass
- class of a componentpropsMatcherPairs
- Pairs of props and their matcherspublic <T2,T1> LithoViewAssert hasDirectMatchingComponentWithMatcher(KClass kClass, <any>... propsMatcherPairs)
kClass
- class of a componentpropsMatcherPairs
- Pairs of props and their matcherspublic static LithoViewAssert.OccurrenceCount times(int i)
public static LithoViewAssert.OccurrenceCount once()