org.fest.assertions.api.android.animation.KeyframeAssert 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.animation;
import android.animation.Keyframe;
import android.animation.TimeInterpolator;
import org.fest.assertions.api.AbstractAssert;
import static org.fest.assertions.api.Assertions.assertThat;
/** Assertions for {@link Keyframe} instances. */
public class KeyframeAssert extends AbstractAssert {
public KeyframeAssert(Keyframe actual) {
super(actual, KeyframeAssert.class);
}
public KeyframeAssert hasFraction(float fraction) {
isNotNull();
float actualFraction = actual.getFraction();
assertThat(actualFraction) //
.overridingErrorMessage("Expected fraction <%s> but was <%s>.", fraction, actualFraction) //
.isEqualTo(fraction);
return this;
}
public KeyframeAssert hasInterpolator(TimeInterpolator interpolator) {
isNotNull();
TimeInterpolator actualInterpolator = actual.getInterpolator();
assertThat(actualInterpolator) //
.overridingErrorMessage("Expected interpolator <%s> but was <%s>.", interpolator,
actualInterpolator) //
.isSameAs(interpolator);
return this;
}
public KeyframeAssert hasType(Class type) {
isNotNull();
Class actualType = actual.getType();
assertThat(actualType) //
.overridingErrorMessage("Expected type <%s> but was <%s>.", type, actualType) //
.isEqualTo(type);
return this;
}
public KeyframeAssert hasValue(Object value) {
isNotNull();
Object actualValue = actual.getValue();
assertThat(actualValue) //
.overridingErrorMessage("Expected value <%s> but was <%s>.", value, actualValue) //
.isEqualTo(value);
return this;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy