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

org.assertj.android.api.widget.ExpandableListViewAssert 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.ExpandableListAdapter;
import android.widget.ExpandableListView;

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

/** Assertions for {@link ExpandableListView} instances. */
public class ExpandableListViewAssert
    extends AbstractListViewAssert {
  public ExpandableListViewAssert(ExpandableListView actual) {
    super(actual, ExpandableListViewAssert.class);
  }

  public ExpandableListViewAssert hasExpandableListAdapter(ExpandableListAdapter adapter) {
    isNotNull();
    ExpandableListAdapter actualAdapter = actual.getExpandableListAdapter();
    assertThat(actualAdapter) //
        .overridingErrorMessage("Expected expandable list adapter <%s> but was <%s>.", adapter,
            actualAdapter) //
        .isSameAs(adapter);
    return this;
  }

  public ExpandableListViewAssert hasSelectedId(long id) {
    isNotNull();
    long actualId = actual.getSelectedId();
    assertThat(actualId) //
        .overridingErrorMessage("Expected selected ID <%s> but was <%s>.", id, actualId) //
        .isEqualTo(id);
    return this;
  }

  public ExpandableListViewAssert hasSelectedPosition(long position) {
    isNotNull();
    long actualPosition = actual.getSelectedPosition();
    assertThat(actualPosition) //
        .overridingErrorMessage("Expected selected position <%s> but was <%s>.", position,
            actualPosition) //
        .isEqualTo(position);
    return this;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy