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

org.fest.assertions.api.android.app.FragmentTransactionAssert Maven / Gradle / Ivy

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

import android.app.FragmentTransaction;
import org.fest.assertions.api.AbstractAssert;

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

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

  public FragmentTransactionAssert isAddToBackStackAllowed() {
    isNotNull();
    assertThat(actual.isAddToBackStackAllowed()) //
        .overridingErrorMessage("Expected add to back stack to be allowed but was disallowed.") //
        .isTrue();
    return this;
  }

  public FragmentTransactionAssert isAddToBackStackDisallowed() {
    isNotNull();
    assertThat(actual.isAddToBackStackAllowed()) //
        .overridingErrorMessage("Expected add to back stack to be disallowed but was allowed.") //
        .isFalse();
    return this;
  }

  public FragmentTransactionAssert isEmpty() {
    isNotNull();
    assertThat(actual.isEmpty()) //
        .overridingErrorMessage("Expected empty transaction but was not empty.") //
        .isTrue();
    return this;
  }

  public FragmentTransactionAssert isNotEmpty() {
    isNotNull();
    assertThat(actual.isEmpty()) //
        .overridingErrorMessage("Expected non-empty transaction but was empty.") //
        .isFalse();
    return this;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy