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

org.assertj.android.api.widget.AbstractCursorAdapterAssert Maven / Gradle / Ivy

The newest version!
// Copyright 2013 Square, Inc.
package org.assertj.android.api.widget;

import android.database.Cursor;
import android.widget.CursorAdapter;
import android.widget.Filter;

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

public abstract class AbstractCursorAdapterAssert, A extends CursorAdapter>
    extends AbstractListAdapterAssert {
  protected AbstractCursorAdapterAssert(A actual, Class selfType) {
    super(actual, selfType);
  }

  public S hasCursor(Cursor cursor) {
    isNotNull();
    Cursor actualCursor = actual.getCursor();
    assertThat(actualCursor) //
        .overridingErrorMessage("Expected cursor <%s> but was <%s>.", cursor, actualCursor) //
        .isSameAs(cursor);
    return myself;
  }

  public S hasFilter(Filter filter) {
    isNotNull();
    Filter actualFilter = actual.getFilter();
    assertThat(actualFilter) //
        .overridingErrorMessage("Expected filter <%s> but was <%s>.", filter, actualFilter) //
        .isSameAs(filter);
    return myself;
  }
}