org.fest.assertions.api.android.widget.AbstractViewAnimatorAssert Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of fest-android Show documentation
Show all versions of fest-android Show documentation
A set of FEST assertion helpers geared toward testing Android.
// Copyright 2012 Square, Inc.
package org.fest.assertions.api.android.widget;
import android.view.View;
import android.widget.ViewAnimator;
import org.fest.assertions.api.ANDROID;
import org.fest.assertions.api.android.view.AbstractViewGroupAssert;
import static org.fest.assertions.api.Assertions.assertThat;
public abstract class AbstractViewAnimatorAssert, A extends ViewAnimator>
extends AbstractViewGroupAssert {
public AbstractViewAnimatorAssert(A actual, Class selfType) {
super(actual, selfType);
}
private View getDisplayedView() {
return actual.getChildAt(actual.getDisplayedChild());
}
public S hasDisplayedChild(View view) {
isNotNull();
View actualView = getDisplayedView();
assertThat(actualView) //
.overridingErrorMessage("Expected displayed child <%s> but was <%s>.", view, actualView) //
.isSameAs(view);
return myself;
}
public S hasDisplayedChildId(int id) {
isNotNull();
ANDROID.assertThat(getDisplayedView()).hasId(id);
return myself;
}
public S hasDisplayedChild(int index) {
isNotNull();
int actualIndex = actual.getDisplayedChild();
assertThat(actualIndex) //
.overridingErrorMessage("Expected displayed child index <%s> but was <%s>.", index,
actualIndex) //
.isEqualTo(index);
return myself;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy