org.assertj.android.api.view.ViewStubAssert Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of assertj-android Show documentation
Show all versions of assertj-android Show documentation
A set of AssertJ assertion helpers geared toward testing Android.
The newest version!
package org.assertj.android.api.view;
import android.view.ViewStub;
import static org.assertj.core.api.Assertions.assertThat;
/** Assertions for {@link ViewStub} instances. */
public class ViewStubAssert extends AbstractViewAssert {
public ViewStubAssert(ViewStub actual) {
super(actual, ViewStubAssert.class);
}
public ViewStubAssert hasInflatedId(int id) {
isNotNull();
int actualId = actual.getInflatedId();
assertThat(actualId) //
.overridingErrorMessage("Expected view stub inflated ID <%s> but was <%s>", id, actualId) //
.isEqualTo(id);
return this;
}
public ViewStubAssert hasLayoutResource(int resId) {
isNotNull();
int actualResId = actual.getLayoutResource();
assertThat(actualResId) //
.overridingErrorMessage("Expected view stub layout resource <%s> but was <%s>", resId,
actualResId) //
.isEqualTo(resId);
return this;
}
}