All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.assertj.android.api.view.ViewStubAssert Maven / Gradle / Ivy

There is a newer version: 1.2.0
Show 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;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy