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

org.fest.assertions.api.android.util.SparseBooleanArrayAssert Maven / Gradle / Ivy

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

import android.util.SparseBooleanArray;
import org.fest.assertions.api.AbstractAssert;

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

/** Assertions for {@link SparseBooleanArray} instances. */
public class SparseBooleanArrayAssert
    extends AbstractAssert {
  public SparseBooleanArrayAssert(SparseBooleanArray actual) {
    super(actual, SparseBooleanArrayAssert.class);
  }

  public SparseBooleanArrayAssert keyIsTrue(int key) {
    isNotNull();
    assertThat(actual.get(key)) //
        .overridingErrorMessage("Expected key %s to be true but was false.", key) //
        .isTrue();
    return this;
  }

  public SparseBooleanArrayAssert keyIsFalse(int key) {
    isNotNull();
    assertThat(actual.get(key)) //
        .overridingErrorMessage("Expected key %s to be false but was true.", key) //
        .isFalse();
    return this;
  }

  public SparseBooleanArrayAssert hasSize(int size) {
    isNotNull();
    int actualSize = actual.size();
    assertThat(actualSize) //
        .overridingErrorMessage("Expected size <%s> but was <%s>.", size, actualSize) //
        .isEqualTo(size);
    return this;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy