public final class ComponentAssert
extends <any>
Component
s.
To create an instance of this class, invoke
or
assertThat(ComponentContext, Component)
.
Alternatively, use assertThat(Component.Builder)
LithoAssertions
which provides entry points to
all Litho AssertJ helpers.
Modifier and Type | Method and Description |
---|---|
static <L extends ComponentLifecycle> |
assertThat(Component.Builder<L,?> builder) |
static ComponentAssert |
assertThat(ComponentContext componentContext,
Component component) |
ComponentAssert |
containsOnlySubComponents(SubComponent... subComponents)
Verifies that the component contains only the given sub-components and nothing else,
in order.
|
ComponentAssert |
containsSubComponent(SubComponent subComponent)
Assert that the given component contains the provided sub-component.
|
ComponentAssert |
doesNotContainSubComponent(SubComponent subComponent)
Assert that the given component does not contain the provided sub-component.
|
ComponentAssert |
doesNotHaveVisibleDrawable(Drawable drawable)
Inverse of
hasVisibleDrawable(Drawable) |
<A> <any> |
extracting(<any> extractor)
Extract values from the underlying component based on the
Extractor provided. |
<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()
Assert that the given component has no sub-components.
|
ComponentAssert |
hasSubComponents(SubComponent... subComponents)
Verifies that the component contains the exact list of provided sub-components.
|
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(String text)
Assert that the given component has the exact text provided.
|
public static ComponentAssert assertThat(ComponentContext componentContext, Component component)
public static <L extends ComponentLifecycle> ComponentAssert assertThat(Component.Builder<L,?> builder)
public ComponentAssert hasNoSubComponents()
public ComponentAssert containsSubComponent(SubComponent subComponent)
public ComponentAssert doesNotContainSubComponent(SubComponent subComponent)
public ComponentAssert hasContentDescription(String contentDescription)
public ComponentAssert hasVisibleDrawable(@DrawableRes int drawableRes)
public ComponentAssert hasVisibleDrawable(Drawable drawable)
public ComponentAssert doesNotHaveVisibleDrawable(Drawable drawable)
hasVisibleDrawable(Drawable)
public ComponentAssert hasVisibleText(String text)
public ComponentAssert hasViewTag(int tagId, Object tagValue)
tagId
- Index of the view tag.tagValue
- View tag value.public ComponentAssert hasSubComponents(SubComponent... subComponents)
public ComponentAssert containsOnlySubComponents(SubComponent... subComponents)
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)