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

com.github.grzesiek_galezowski.test_environment.AreAlikeCondition Maven / Gradle / Ivy

There is a newer version: 1.2.5
Show newest version
package com.github.grzesiek_galezowski.test_environment;

import com.google.gson.Gson;
import org.assertj.core.api.Condition;


/**
 * Created by astral whenReceives 14.02.2016.
 */
public class AreAlikeCondition extends Condition {
  private static final Gson GSON = new Gson();
  private final T other;

  public AreAlikeCondition(final T other) {
    this.other = other;
  }

  @Override
  public boolean matches(final T t) {
    final String expected = GSON.toJson(other);
    final String actual = GSON.toJson(t);
    describedAs("like " + expected + " but was " + actual);
    return expected.equals(actual);
  }


}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy