org.fest.assertions.api.android.widget.ToggleButtonAssert 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 2013 Square, Inc.
package org.fest.assertions.api.android.widget;
import android.widget.ToggleButton;
import static org.fest.assertions.api.Assertions.assertThat;
public class ToggleButtonAssert
extends AbstractCompoundButtonAssert {
public ToggleButtonAssert(ToggleButton actual) {
super(actual, ToggleButtonAssert.class);
}
public ToggleButtonAssert hasOnText(CharSequence text) {
isNotNull();
CharSequence actualText = actual.getTextOn();
assertThat(actualText) //
.overridingErrorMessage("Expected 'on' text <%s> but was <%s>.", text, actualText) //
.isEqualTo(text);
return this;
}
public ToggleButtonAssert hasOnText(int resId) {
isNotNull();
return hasOnText(actual.getContext().getString(resId));
}
public ToggleButtonAssert hasOffText(CharSequence text) {
isNotNull();
CharSequence actualText = actual.getTextOff();
assertThat(actualText) //
.overridingErrorMessage("Expected 'off' text <%s> but was <%s>.", text, actualText) //
.isEqualTo(text);
return this;
}
public ToggleButtonAssert hasOffText(int resId) {
isNotNull();
return hasOffText(actual.getContext().getString(resId));
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy