All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.assertj.android.api.gesture.OrientedBoundingBoxAssert Maven / Gradle / Ivy

There is a newer version: 1.2.0
Show newest version
// Copyright 2013 Square, Inc.
package org.assertj.android.api.gesture;

import android.gesture.OrientedBoundingBox;
import org.assertj.core.api.AbstractAssert;

import static org.assertj.core.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