public final class ComponentAssert
extends <any>
Component
s.
To create an instance of this class, invoke
or assertThat(ComponentContext, Component)
.
assertThat(Component.Builder)
Alternatively, use LithoAssertions
which provides entry points to all Litho AssertJ
helpers.
Modifier and Type | Method and Description |
---|---|
LithoViewAssert |
afterStateUpdate()
Performs a state update and returns the new view.
|
static ComponentAssert |
assertThat(Component.Builder<?> builder) |
static ComponentAssert |
assertThat(ComponentContext componentContext,
Component component) |
ComponentAssert |
containsOnlySubComponents(SubComponent... subComponents)
Deprecated.
|
ComponentAssert |
containsSubComponent(SubComponent subComponent)
Deprecated.
|
ComponentAssert |
doesNotContainSubComponent(SubComponent subComponent)
Deprecated.
|
ComponentAssert |
doesNotHaveVisibleDrawable(Drawable drawable)
Inverse of
hasVisibleDrawable(Drawable) |
ComponentAssert |
doesNotHaveVisibleText(String text)
Inverse of
hasVisibleText(String) |
<A> <any> |
extracting(<any> extractor)
Extract values from the underlying component based on the
Extractor provided. |
ComponentAssert |
extractingSubComponentAt(int index) |
<any> |
extractingSubComponents(ComponentContext c)
Extract the sub components from the underlying Component, returning a ListAssert over it.
|
<any> |
extractingSubComponentsDeeply(ComponentContext c)
Extract the sub components recursively from the underlying Component, returning a ListAssert
over it.
|
ComponentAssert |
hasContentDescription(String contentDescription)
Assert that any view in the given Component has the provided content description.
|
ComponentAssert |
hasNoSubComponents()
Deprecated.
|
ComponentAssert |
hasSubComponents(SubComponent... subComponents)
Deprecated.
|
ComponentAssert |
hasViewTag(int tagId,
Object tagValue)
Assert that the view tag is present for the given index.
|
ComponentAssert |
hasVisibleDrawable(Drawable drawable)
Assert that the given component contains the drawable provided.
|
ComponentAssert |
hasVisibleDrawable(int drawableRes)
Assert that the given component contains the drawable identified by the provided drawable
resource id.
|
ComponentAssert |
hasVisibleText(int resourceId)
Assert that the given component has the exact text identified by resource id.
|
ComponentAssert |
hasVisibleText(String text)
Assert that the given component has the exact text provided.
|
ComponentAssert |
hasVisibleTextMatching(String pattern)
Assert that the given component contains the provided pattern.
|
ComponentAssert |
willNotRender() |
ComponentAssert |
willRender()
Assert that a given
Component produces a layout that's not equivalent to ComponentContext.NULL_LAYOUT . |
LithoViewAssert |
withStateUpdate(StateUpdatesTestHelper.StateUpdater updater) |
ComponentAssert |
wontRender()
Assert that a given
Component renders to null, i.e. |
public static ComponentAssert assertThat(ComponentContext componentContext, Component component)
public static ComponentAssert assertThat(Component.Builder<?> builder)
public LithoViewAssert afterStateUpdate()
public LithoViewAssert withStateUpdate(StateUpdatesTestHelper.StateUpdater updater)
@Deprecated public ComponentAssert hasNoSubComponents()
extractingSubComponents(com.facebook.litho.ComponentContext)
instead.@Deprecated public ComponentAssert containsSubComponent(SubComponent subComponent)
extractingSubComponents(com.facebook.litho.ComponentContext)
instead.@Deprecated public ComponentAssert doesNotContainSubComponent(SubComponent subComponent)
extractingSubComponents(com.facebook.litho.ComponentContext)
instead.public ComponentAssert hasContentDescription(String contentDescription)
public ComponentAssert hasVisibleDrawable(int drawableRes)
public ComponentAssert hasVisibleDrawable(Drawable drawable)
public ComponentAssert doesNotHaveVisibleDrawable(Drawable drawable)
hasVisibleDrawable(Drawable)
public ComponentAssert hasVisibleText(String text)
public ComponentAssert hasVisibleText(int resourceId)
public ComponentAssert doesNotHaveVisibleText(String text)
hasVisibleText(String)
public ComponentAssert hasVisibleTextMatching(String pattern)
public ComponentAssert hasViewTag(int tagId, Object tagValue)
tagId
- Index of the view tag.tagValue
- View tag value.@Deprecated public ComponentAssert hasSubComponents(SubComponent... subComponents)
extractingSubComponents(com.facebook.litho.ComponentContext)
instead.@Deprecated public ComponentAssert containsOnlySubComponents(SubComponent... subComponents)
extractingSubComponents(com.facebook.litho.ComponentContext)
instead.public <A> <any> extracting(<any> extractor)
Extractor
provided.A
- Type of the value extracted.extractor
- The extractor applied to the Component.public <any> extractingSubComponents(ComponentContext c)
public <any> extractingSubComponentsDeeply(ComponentContext c)
public ComponentAssert extractingSubComponentAt(int index)
public ComponentAssert wontRender()
Component
renders to null, i.e. its onCreateLayout
method resolves to a ComponentContext.NULL_LAYOUT
.public ComponentAssert willRender()
Component
produces a layout that's not equivalent to ComponentContext.NULL_LAYOUT
.public ComponentAssert willNotRender()
wontRender()