org.assertj.android.api.gesture.GestureStrokeAssert 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.GestureStroke;
import android.graphics.RectF;
import org.assertj.core.api.AbstractAssert;
import static org.assertj.core.api.Assertions.assertThat;
/** Assertions for {@link GestureStroke} instances. */
public class GestureStrokeAssert extends AbstractAssert {
public GestureStrokeAssert(GestureStroke actual) {
super(actual, GestureStrokeAssert.class);
}
public GestureStrokeAssert hasBoundingBox(RectF rect) {
isNotNull();
RectF actualRect = actual.boundingBox;
assertThat(actualRect) //
.overridingErrorMessage("Expected bounding box <%s> but was <%s>.", rect, actualRect) //
.isEqualTo(rect);
return this;
}
public GestureStrokeAssert hasLength(float length) {
isNotNull();
float actualLength = actual.length;
assertThat(actualLength) //
.overridingErrorMessage("Expected length <%s> but was <%s>.", length, actualLength) //
.isEqualTo(length);
return this;
}
public GestureStrokeAssert hasPoints(float[] points) {
isNotNull();
float[] actualPoints = actual.points;
assertThat(actualPoints) //
.overridingErrorMessage("Expected points <%s> but was <%s>.", points, actualPoints) //
.isEqualTo(points);
return this;
}
}