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

com.connect_group.thymeleaf.testing.hamcrest.ThymeleafMatchers Maven / Gradle / Ivy

The newest version!
package com.connect_group.thymeleaf.testing.hamcrest;

import com.connect_group.thymesheet.query.HtmlElement;
import com.connect_group.thymesheet.query.HtmlElements;
import java.util.Collection;
import org.hamcrest.Factory;
import org.hamcrest.Matcher;

public abstract class ThymeleafMatchers {

  @Factory
  public static Matcher exists() {
    return new Exists();
  }

  @Factory
  public static Matcher hasAttribute(String attributeName) {
    return new HasAttribute(attributeName);
  }

  @Factory
  public static Matcher hasAttributeWithAnyNonNullValue(String attributeName) {
    return new HasAttribute(attributeName, true);
  }

  @Factory
  public static Matcher hasAttribute(String attributeName, String attributeValue) {
    return new HasAttribute(attributeName, attributeValue);
  }

  @Factory
  public static Matcher hasChildren() {
    return new HasChildren();
  }

  @Factory
  public static Matcher hasClass(String className) {
    return new HasClass(className);
  }

  @Factory
  public static Matcher hasClasses(String classNames) {
    return new HasClass(classNames);
  }

  @Factory
  public static Matcher hasComment() {
    return new HasComment();
  }

  @Factory
  public static Matcher hasCommentWithText(String text) {
    return new HasComment(text);
  }

  @Factory
  public static Matcher hasOnlyText(String text) {
    return new HasOnlyText(text);
  }

  @Factory
  public static Matcher hasOnlyText(String... text) {
    return new HasTextInOrder(text);
  }

  @Factory
  public static Matcher isSingleElementThat(Matcher matches) {
    return new IsSingleElementThat(matches);
  }

  @Factory
  public static Matcher> occursOnce() {
    return new OccursOnce();
  }

  @Factory
  public static Matcher hasTextBeforeElement(String text) {
    return new HasTextBeforeElement(text);
  }

  @Factory
  public static Matcher hasTextAfterElement(String text) {
    return new HasTextAfterElement(text);
  }
}