org.assertj.android.api.widget.TabWidgetAssert 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.annotation.TargetApi;
import android.widget.TabWidget;
import static android.os.Build.VERSION_CODES.FROYO;
import static org.assertj.core.api.Assertions.assertThat;
/** Assertions for {@link TabWidget} instances. */
public class TabWidgetAssert extends AbstractLinearLayoutAssert {
public TabWidgetAssert(TabWidget actual) {
super(actual, TabWidgetAssert.class);
}
public TabWidgetAssert hasTabCount(int count) {
isNotNull();
int actualCount = actual.getTabCount();
assertThat(actualCount) //
.overridingErrorMessage("Expected tab count <%s> but was <%s>.", count, actualCount) //
.isEqualTo(count);
return this;
}
@TargetApi(FROYO)
public TabWidgetAssert isStripEnabled() {
isNotNull();
assertThat(actual.isStripEnabled()) //
.overridingErrorMessage("Expected strip to be enabled but was disabled.") //
.isTrue();
return this;
}
@TargetApi(FROYO)
public TabWidgetAssert isStripDisabled() {
isNotNull();
assertThat(actual.isStripEnabled()) //
.overridingErrorMessage("Expected strip to be disabled but was enabled.") //
.isFalse();
return this;
}
}