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

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

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

import android.widget.SimpleCursorAdapter;

import static android.widget.SimpleCursorAdapter.CursorToStringConverter;
import static android.widget.SimpleCursorAdapter.ViewBinder;
import static org.assertj.core.api.Assertions.assertThat;

/** Assertions for {@link SimpleCursorAdapter} instances. */
public class SimpleCursorAdapterAssert
    extends AbstractCursorAdapterAssert {
  public SimpleCursorAdapterAssert(SimpleCursorAdapter actual) {
    super(actual, SimpleCursorAdapterAssert.class);
  }

  public SimpleCursorAdapterAssert hasCursorToStringConverter(CursorToStringConverter converter) {
    isNotNull();
    CursorToStringConverter actualConverter = actual.getCursorToStringConverter();
    assertThat(actualConverter) //
        .overridingErrorMessage("Expected cursor 'toString' converter <%s> but was <%s>.",
            converter, actualConverter) //
        .isSameAs(converter);
    return this;
  }

  public SimpleCursorAdapterAssert hasStringConversionColumn(int column) {
    isNotNull();
    int actualColumn = actual.getStringConversionColumn();
    assertThat(actualColumn) //
        .overridingErrorMessage("Expected string conversion column <%s> but was <%s>.", column,
            actualColumn) //
        .isEqualTo(column);
    return this;
  }

  public SimpleCursorAdapterAssert hasViewBinder(ViewBinder binder) {
    isNotNull();
    ViewBinder actualBinder = actual.getViewBinder();
    assertThat(actualBinder) //
        .overridingErrorMessage("Expected view binder <%s> but was <%s>.", binder, actualBinder) //
        .isSameAs(binder);
    return this;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy