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

org.assertj.android.api.util.PairAssert Maven / Gradle / Ivy

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

import android.util.Pair;
import org.assertj.core.api.AbstractAssert;

import static org.assertj.core.api.Assertions.assertThat;

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

  public PairAssert hasFirst(F first) {
    isNotNull();
    F actualFirst = actual.first;
    assertThat(actualFirst) //
        .overridingErrorMessage("Expected first value <%s> but was <%s>.", first, actualFirst) //
        .isEqualTo(first);
    return this;
  }

  public PairAssert hasSecond(S second) {
    isNotNull();
    S actualSecond = actual.second;
    assertThat(actualSecond) //
        .overridingErrorMessage("Expected second value <%s> but was <%s>.", second, actualSecond) //
        .isEqualTo(second);
    return this;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy