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

com.codeborne.selenide.ObjectCondition Maven / Gradle / Ivy

There is a newer version: 7.7.3
Show newest version
package com.codeborne.selenide;

import com.codeborne.selenide.conditions.ExplainedObjectCondition;
import org.jspecify.annotations.Nullable;

import static com.codeborne.selenide.CheckResult.accepted;
import static com.codeborne.selenide.CheckResult.rejected;

public interface ObjectCondition {
  String description();

  String negativeDescription();

  CheckResult check(T object);

  @Nullable
  String expectedValue();

  String describe(T object);

  default String message(T object) {
    return describe(object) + " " + description();
  }

  default CheckResult result(T object, boolean met, @Nullable Object actualValue) {
    return met ? accepted(actualValue) : rejected(message(object), actualValue);
  }

  default ObjectCondition because(String message) {
    return new ExplainedObjectCondition<>(this, message);
  }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy