org.assertj.android.api.gesture.GestureAssert 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.gesture;
import android.gesture.Gesture;
import org.assertj.core.api.AbstractAssert;
import static org.assertj.core.api.Assertions.assertThat;
/** Assertions for {@link Gesture} instances. */
public class GestureAssert extends AbstractAssert {
public GestureAssert(Gesture actual) {
super(actual, GestureAssert.class);
}
public GestureAssert hasId(long id) {
isNotNull();
long actualId = actual.getID();
assertThat(actualId) //
.overridingErrorMessage("Expected ID <%s> but was <%s>.", id, actualId) //
.isEqualTo(id);
return this;
}
public GestureAssert hasLength(float length) {
isNotNull();
float actualLength = actual.getLength();
assertThat(actualLength) //
.overridingErrorMessage("Expected length <%s> but was <%s>.", length, actualLength) //
.isEqualTo(length);
return this;
}
public GestureAssert hasStrokeCount(int count) {
isNotNull();
int actualCount = actual.getStrokesCount();
assertThat(actualCount) //
.overridingErrorMessage("Expected stroke count <%s> but was <%s>.", count, actualCount) //
.isEqualTo(count);
return this;
}
}