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

org.assertj.android.api.graphics.CameraAssert Maven / Gradle / Ivy

The newest version!
// Copyright 2013 Square, Inc.
package org.assertj.android.api.graphics;

import android.annotation.TargetApi;
import android.graphics.Camera;
import org.assertj.core.api.AbstractAssert;

import static android.os.Build.VERSION_CODES.JELLY_BEAN;
import static org.assertj.core.api.Assertions.assertThat;

/** Assertions for {@link Camera} instances. */
public class CameraAssert extends AbstractAssert {
  public CameraAssert(Camera actual) {
    super(actual, CameraAssert.class);
  }

  @TargetApi(JELLY_BEAN)
  public CameraAssert hasLocationX(float location) {
    isNotNull();
    float actualLocation = actual.getLocationX();
    assertThat(actualLocation) //
        .overridingErrorMessage("Expected X location <%s> but was <%s>.", location,
            actualLocation) //
        .isEqualTo(location);
    return this;
  }

  @TargetApi(JELLY_BEAN)
  public CameraAssert hasLocationY(float location) {
    isNotNull();
    float actualLocation = actual.getLocationY();
    assertThat(actualLocation) //
        .overridingErrorMessage("Expected Y location <%s> but was <%s>.", location,
            actualLocation) //
        .isEqualTo(location);
    return this;
  }

  @TargetApi(JELLY_BEAN)
  public CameraAssert hasLocationZ(float location) {
    isNotNull();
    float actualLocation = actual.getLocationZ();
    assertThat(actualLocation) //
        .overridingErrorMessage("Expected Z location <%s> but was <%s>.", location,
            actualLocation) //
        .isEqualTo(location);
    return this;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy