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

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

package com.github.grzesiek_galezowski.test_environment;

import org.assertj.core.api.Condition;

/**
 * Created by grzes on 26.06.2017.
 */
public class Item {
  public static  Condition equalTo(final T expected) {
    return new Condition() {
      @Override
      public boolean matches(final T item) {
        boolean result = item.equals(expected);
        describedAs(
            item.toString()
                + " is"
                + okOrNot(result)
                + " equal to expected "
                + expected.toString());
        return result;
      }

      public String okOrNot(final boolean result) {
        if (result) {
          return "";
        } else {
          return " not";
        }
      }

      @Override
      public String toString() {
        return "equal to " + expected;
      }
    };
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy