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

org.assertj.android.api.gesture.GestureAssert 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.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;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy