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

org.assertj.android.api.graphics.drawable.AnimationDrawableAssert Maven / Gradle / Ivy

There is a newer version: 1.2.0
Show newest version
// Copyright 2013 Square, Inc.
package org.assertj.android.api.graphics.drawable;

import android.graphics.drawable.AnimationDrawable;

import static org.assertj.core.api.Assertions.assertThat;

/** Assertions for {@link AnimationDrawable} instances. */
public class AnimationDrawableAssert
    extends AbstractDrawableAssert {
  public AnimationDrawableAssert(AnimationDrawable actual) {
    super(actual, AnimationDrawableAssert.class);
  }

  public AnimationDrawableAssert hasFrameCount(int count) {
    isNotNull();
    int actualCount = actual.getNumberOfFrames();
    assertThat(actualCount) //
        .overridingErrorMessage("Expected frame count <%s> but was <%s>.", count, actualCount) //
        .isEqualTo(count);
    return this;
  }

  public AnimationDrawableAssert isOneShot() {
    isNotNull();
    assertThat(actual.isOneShot()) //
        .overridingErrorMessage("Expected to be one-short but was not.") //
        .isTrue();
    return this;
  }

  public AnimationDrawableAssert isNotOneShot() {
    isNotNull();
    assertThat(actual.isOneShot()) //
        .overridingErrorMessage("Expected to not be one-shot but was.") //
        .isFalse();
    return this;
  }

  public AnimationDrawableAssert isRunning() {
    isNotNull();
    assertThat(actual.isRunning()) //
        .overridingErrorMessage("Expected to be running but was not.") //
        .isTrue();
    return this;
  }

  public AnimationDrawableAssert isNotRunning() {
    isNotNull();
    assertThat(actual.isRunning()) //
        .overridingErrorMessage("Expected to not be running but was.") //
        .isFalse();
    return this;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy