org.assertj.android.api.widget.ExpandableListViewAssert Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of assertj-android Show documentation
Show all versions of assertj-android Show documentation
A set of AssertJ assertion helpers geared toward testing Android.
// 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;
}
}