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

org.fest.assertions.api.android.view.AbstractViewGroupMarginLayoutParamsAssert Maven / Gradle / Ivy

There is a newer version: 1.0.8
Show newest version
package org.fest.assertions.api.android.view;

import android.view.ViewGroup;

import static org.fest.assertions.api.Assertions.assertThat;

public abstract class AbstractViewGroupMarginLayoutParamsAssert, A extends ViewGroup.MarginLayoutParams>
    extends AbstractViewGroupLayoutParamsAssert {
  protected AbstractViewGroupMarginLayoutParamsAssert(A actual, Class selfType) {
    super(actual, selfType);
  }

  public S hasBottomMargin(int margin) {
    isNotNull();
    int actualMargin = actual.bottomMargin;
    assertThat(actualMargin) //
        .overridingErrorMessage("Expected bottom margin <%s> but was <%s>", margin, actualMargin) //
        .isEqualTo(margin);
    return myself;
  }

  public S hasLeftMargin(int margin) {
    isNotNull();
    int actualMargin = actual.leftMargin;
    assertThat(actualMargin) //
        .overridingErrorMessage("Expected left margin <%s> but was <%s>", margin, actualMargin) //
        .isEqualTo(margin);
    return myself;
  }

  public S hasRightMargin(int margin) {
    isNotNull();
    int actualMargin = actual.rightMargin;
    assertThat(actualMargin) //
        .overridingErrorMessage("Expected right margin <%s> but was <%s>", margin, actualMargin) //
        .isEqualTo(margin);
    return myself;
  }

  public S hasTopMargin(int margin) {
    isNotNull();
    int actualMargin = actual.topMargin;
    assertThat(actualMargin) //
        .overridingErrorMessage("Expected top margin <%s> but was <%s>", margin, actualMargin) //
        .isEqualTo(margin);
    return myself;
  }
}