org.fest.assertions.api.android.gesture.OrientedBoundingBoxAssert 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.
// Copyright 2013 Square, Inc.
package org.fest.assertions.api.android.gesture;
import android.gesture.OrientedBoundingBox;
import org.fest.assertions.api.AbstractAssert;
import static org.fest.assertions.api.Assertions.assertThat;
/** Assertions for {@link OrientedBoundingBox} instances. */
public class OrientedBoundingBoxAssert
extends AbstractAssert {
public OrientedBoundingBoxAssert(OrientedBoundingBox actual) {
super(actual, OrientedBoundingBoxAssert.class);
}
public OrientedBoundingBoxAssert hasCenterX(float centerX) {
isNotNull();
float actualCenterX = actual.centerX;
assertThat(actualCenterX) //
.overridingErrorMessage("Expected X center <%s> but was <%s>.", centerX, actualCenterX) //
.isEqualTo(centerX);
return this;
}
public OrientedBoundingBoxAssert hasCenterY(float centerY) {
isNotNull();
float actualCenterY = actual.centerY;
assertThat(actualCenterY) //
.overridingErrorMessage("Expected Y center <%s> but was <%s>.", centerY, actualCenterY) //
.isEqualTo(centerY);
return this;
}
public OrientedBoundingBoxAssert hasHeight(float height) {
isNotNull();
float actualHeight = actual.height;
assertThat(actualHeight) //
.overridingErrorMessage("Expected height <%s> but was <%s>.", height, actualHeight) //
.isEqualTo(height);
return this;
}
public OrientedBoundingBoxAssert hasOrientation(float orientation) {
isNotNull();
float actualOrientation = actual.orientation;
assertThat(actualOrientation) //
.overridingErrorMessage("Expected orientation <%s> but was <%s>.", orientation,
actualOrientation) //
.isEqualTo(orientation);
return this;
}
public OrientedBoundingBoxAssert hasSquareness(float squareness) {
isNotNull();
float actualSquareness = actual.squareness;
assertThat(actualSquareness) //
.overridingErrorMessage("Expected squareness <%s> but was <%s>.", squareness,
actualSquareness) //
.isEqualTo(squareness);
return this;
}
public OrientedBoundingBoxAssert hasWidth(float width) {
isNotNull();
float actualWidth = actual.width;
assertThat(actualWidth) //
.overridingErrorMessage("Expected width <%s> but was <%s>.", width, actualWidth) //
.isEqualTo(width);
return this;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy