org.assertj.android.api.widget.CheckedTextViewAssert 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.graphics.drawable.Drawable;
import android.widget.CheckedTextView;
import org.assertj.core.api.Assertions;
import static android.os.Build.VERSION_CODES.JELLY_BEAN;
import static org.assertj.core.api.Assertions.assertThat;
public class CheckedTextViewAssert
extends AbstractTextViewAssert {
public CheckedTextViewAssert(CheckedTextView actual) {
super(actual, CheckedTextViewAssert.class);
}
@TargetApi(JELLY_BEAN)
public CheckedTextViewAssert hasCheckMarkDrawable(Drawable drawable) {
isNotNull();
Drawable actualDrawable = actual.getCheckMarkDrawable();
Assertions.assertThat(actualDrawable) //
.overridingErrorMessage("Expected check mark drawable <%s> but was <%s>.", drawable,
actualDrawable) //
.isSameAs(drawable);
return this;
}
public CheckedTextViewAssert isChecked() {
isNotNull();
assertThat(actual.isChecked()) //
.overridingErrorMessage("Expected checked but was not checked.") //
.isTrue();
return this;
}
public CheckedTextViewAssert isNotChecked() {
isNotNull();
assertThat(actual.isChecked()) //
.overridingErrorMessage("Expected not checked but was checked.") //
.isFalse();
return this;
}
}