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

org.assertj.android.api.widget.AbstractRelativeLayoutAssert Maven / Gradle / Ivy

There is a newer version: 1.2.0
Show newest version
package org.assertj.android.api.widget;

import android.annotation.TargetApi;
import android.widget.RelativeLayout;
import org.assertj.android.api.view.AbstractViewGroupAssert;

import static android.os.Build.VERSION_CODES.JELLY_BEAN;
import static org.assertj.core.api.Assertions.assertThat;

public abstract class AbstractRelativeLayoutAssert, A extends RelativeLayout>
    extends AbstractViewGroupAssert {
  protected AbstractRelativeLayoutAssert(A actual, Class selfType) {
    super(actual, selfType);
  }

  @TargetApi(JELLY_BEAN)
  public S hasGravity(int gravity) {
    isNotNull();
    int actualGravity = actual.getGravity();
    assertThat(actualGravity) //
        .overridingErrorMessage("Expected gravity <%s> but was <%s>.", gravity, actualGravity) //
        .isEqualTo(gravity);
    return myself;
  }
}