org.fest.assertions.api.android.util.PropertyAssert 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.
package org.fest.assertions.api.android.util;
import android.util.Property;
import org.fest.assertions.api.AbstractAssert;
import static org.fest.assertions.api.Assertions.assertThat;
/** Assertions for {@link Property} instances. */
public class PropertyAssert extends AbstractAssert, Property> {
public PropertyAssert(Property actual) {
super(actual, PropertyAssert.class);
}
public PropertyAssert hasName(String name) {
isNotNull();
String actualName = actual.getName();
assertThat(actualName) //
.overridingErrorMessage("Expected name <%s> but was <%s>", name, actualName) //
.isEqualTo(name);
return this;
}
public PropertyAssert hasType(Class> type) {
isNotNull();
Class actualType = actual.getType();
assertThat(actualType) //
.overridingErrorMessage("Expected type <%s> but was <%s>", type, actualType) //
.isEqualTo(type);
return this;
}
public PropertyAssert isReadOnly() {
isNotNull();
assertThat(actual.isReadOnly()) //
.overridingErrorMessage("Expected read only but was not read only.") //
.isTrue();
return this;
}
public PropertyAssert isNotReadOnly() {
isNotNull();
assertThat(actual.isReadOnly()) //
.overridingErrorMessage("Expected not read only but was read only.") //
.isFalse();
return this;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy