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

org.fest.assertions.api.android.widget.SlidingDrawerAssert Maven / Gradle / Ivy

There is a newer version: 1.0.8
Show newest version
// Copyright 2013 Square, Inc.
package org.fest.assertions.api.android.widget;

import android.view.View;
import android.widget.SlidingDrawer;
import org.fest.assertions.api.android.view.AbstractViewGroupAssert;

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

/** Assertions for {@link SlidingDrawer} instances. */
public class SlidingDrawerAssert
    extends AbstractViewGroupAssert {
  public SlidingDrawerAssert(SlidingDrawer actual) {
    super(actual, SlidingDrawerAssert.class);
  }

  public SlidingDrawerAssert hasContent(View view) {
    isNotNull();
    View actualView = actual.getContent();
    assertThat(actualView) //
        .overridingErrorMessage("Expected content <%s> but was <%s>.", view, actualView) //
        .isSameAs(view);
    return this;
  }

  public SlidingDrawerAssert hasHandle(View view) {
    isNotNull();
    View actualView = actual.getHandle();
    assertThat(actualView) //
        .overridingErrorMessage("Expected handle <%s> but was <%s>.", view, actualView) //
        .isSameAs(view);
    return this;
  }

  public SlidingDrawerAssert isMoving() {
    isNotNull();
    assertThat(actual.isMoving()) //
        .overridingErrorMessage("Expected to be moving but was not.") //
        .isTrue();
    return this;
  }

  public SlidingDrawerAssert isNotMoving() {
    isNotNull();
    assertThat(actual.isMoving()) //
        .overridingErrorMessage("Expected to not be moving but was.") //
        .isFalse();
    return this;
  }

  public SlidingDrawerAssert isOpened() {
    isNotNull();
    assertThat(actual.isMoving()) //
        .overridingErrorMessage("Expected to be opened but was closed.") //
        .isTrue();
    return this;
  }

  public SlidingDrawerAssert isClosed() {
    isNotNull();
    assertThat(actual.isMoving()) //
        .overridingErrorMessage("Expected to be closed but was open.") //
        .isFalse();
    return this;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy