Package ext.jtester.hamcrest

Examples of ext.jtester.hamcrest.Matcher


    return (IStringAssert) this.assertThat(matcher);
  }

  public IStringAssert notContain(String sub, StringMode... modes) {
    StringContainMatcher matcher = new StringContainMatcher(new String[] { sub }, modes);
    Matcher _matcher = IsNot.not(matcher);
    return this.assertThat(_matcher);
  }
View Full Code Here


    for (String sub : subs) {
      StringContainMatcher matcher = new StringContainMatcher(new String[] { sub }, modes);
      matchers.add(matcher);
    }

    Matcher _matcher = AnyOf.notAny(matchers);
    return this.assertThat(_matcher);
  }
View Full Code Here

    matcher.setStringModes(StringMode.IgnoreSpace);
    return this.assertThat("expect equal when ignore all space.", matcher);
  }

  public IStringAssert regular(String regex) {
    Matcher matcher = new Matches(regex);
    return (IStringAssert) this.assertThat(matcher);
  }
View Full Code Here

    Matcher matcher = new Matches(regex);
    return (IStringAssert) this.assertThat(matcher);
  }

  public IStringAssert notBlank() {
    Matcher matcher = IsNot.not(new StringBlankMatcher());
    return this.assertThat("expect string is blank", matcher);
  }
View Full Code Here

    return anyOf(Arrays.asList(matchers));
  }

  @Factory
  public static <T> Matcher notAny(Iterable<Matcher> matchers) {
    Matcher matcher = IsNot.not(AnyOf.anyOf(matchers));
    return matcher;
  }
View Full Code Here

    this.type = AssertType.AssertStyle;
  }

  public ICollectionAssert isJSONArray() {
    CollectionAssert collectionAssert = null;
    Matcher matcher = Is.isA(LinkedList.class);
    if (this.type == AssertType.AssertStyle) {
      if (this.value instanceof LinkedList) {
        collectionAssert = new CollectionAssert((LinkedList) this.value);
      } else {
        MatcherAssert.assertThat(this.value, matcher);
View Full Code Here

    return collectionAssert.assertThat(matcher);
  }

  public IMapAssert isJSONMap() {
    MapAssert mapAssert = null;
    Matcher matcher = Is.isA(LinkedHashMap.class);
    if (this.type == AssertType.AssertStyle) {
      if (this.value instanceof Map) {
        mapAssert = new MapAssert((Map) this.value);
      } else {
        MatcherAssert.assertThat(this.value, matcher);
View Full Code Here

    return mapAssert.assertThat(matcher);
  }

  public IStringAssert isSimple() {
    StringAssert stringAssert = null;
    Matcher matcher = Is.isA(String.class);
    if (this.type == AssertType.AssertStyle) {
      if (this.value instanceof String) {
        stringAssert = new StringAssert((String) this.value);
      } else {
        MatcherAssert.assertThat(this.value, matcher);
View Full Code Here

  }

  @SuppressWarnings("unchecked")
  @Factory
  public static <T> Matcher<T> notAll(Iterable<Matcher> matchers) {
    Matcher matcher = IsNot.not(AllOf.allOf(matchers));
    return matcher;
  }
View Full Code Here

    hamcrestMatcher.describeTo(strDescription);
    description.appendText(strDescription.toString());
  }

  public Object getInnerValue() {
    Matcher innerMatcher = hamcrestMatcher;

    while (innerMatcher instanceof ext.jtester.hamcrest.core.Is
        || innerMatcher instanceof ext.jtester.hamcrest.core.IsNot) {
      innerMatcher = getField(innerMatcher.getClass(), Matcher.class, innerMatcher);
    }

    if (innerMatcher instanceof IsEqual || innerMatcher instanceof IsSame
        || innerMatcher instanceof OrderingComparison) {
      return getField(innerMatcher.getClass(), Object.class, innerMatcher);
    } else {
      return null;
    }
  }
View Full Code Here

TOP

Related Classes of ext.jtester.hamcrest.Matcher

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.