org.fest.assertions.api.android.content.IntentAssert 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.content;
import android.content.Intent;
import org.fest.assertions.api.AbstractAssert;
import static org.fest.assertions.api.Assertions.assertThat;
/** Assertions for {@link Intent} instances. */
public class IntentAssert extends AbstractAssert {
public IntentAssert(Intent actual) {
super(actual, IntentAssert.class);
}
public IntentAssert hasAction(String action) {
isNotNull();
String actualAction = actual.getAction();
assertThat(actualAction) //
.overridingErrorMessage("Expected action <%s> but was <%s>.", action, actualAction) //
.isEqualTo(action);
return this;
}
public IntentAssert hasType(String type) {
isNotNull();
String actualType = actual.getType();
assertThat(actualType) //
.overridingErrorMessage("Expected type <%s> but was <%s>.", type, actualType) //
.isEqualTo(type);
return this;
}
public IntentAssert hasExtra(String name) {
isNotNull();
assertThat(actual.hasExtra(name)) //
.overridingErrorMessage("Expected extra <%s> to be present but was not present.", name) //
.isTrue();
return this;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy