Class TapirAssertions


  • @Component("tapirAssertions")
    @Deprecated
    public class TapirAssertions
    extends java.lang.Object
    Deprecated.
    Since 3.1.0 use AssertJ based assertions.
    TapirAssertions provides matcher methods in order to provide a subset of Hamcrest. The methods are provided in a non-static manner, so they are usable as Xtend extensions.
    Since:
    2.0.0
    Author:
    Oliver Libutzki <[email protected]>
    See Also:
    Matcher
    • Constructor Summary

      Constructors 
      Constructor Description
      TapirAssertions()
      Deprecated.
       
    • Method Summary

      All Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      <T> org.hamcrest.core.AnyOf<T> anyOf​(T... items)
      Deprecated.
      Since 3.1.0 use AssertJ based assertions.
      void assertThat​(boolean value)
      Deprecated.
      Since 3.1.0 use AssertJ based assertions.
      void assertThat​(boolean value, java.lang.String reason)
      Deprecated.
      Since 3.1.0 use AssertJ based assertions.
      <T> void assertThat​(T actual, org.hamcrest.Matcher<? super T> matcher, java.lang.String reason)
      Deprecated.
      Since 3.1.0 use AssertJ based assertions.
      <T> void assertThat​(T actual, org.hamcrest.Matcher<T> matcher)
      Deprecated.
      Since 3.1.0 use AssertJ based assertions.
      <T> org.hamcrest.Matcher<java.lang.Iterable<? extends T>> containsInAnyOrder​(T... items)
      Deprecated.
      Since 3.1.0 use AssertJ based assertions.
      org.hamcrest.Matcher<java.lang.String> containsString​(java.lang.String substring)
      Deprecated.
      Since 3.1.0 use AssertJ based assertions.
      org.hamcrest.Matcher<java.lang.String> endsWith​(java.lang.String suffix)
      Deprecated.
      Since 3.1.0 use AssertJ based assertions.
      void fail​(java.lang.String message)
      Deprecated.
      Since 3.1.0 use AssertJ based assertions.
      <T extends java.lang.Comparable<T>>
      org.hamcrest.Matcher<T>
      greaterThan​(T value)
      Deprecated.
      Since 3.1.0 use AssertJ based assertions.
      <T extends java.lang.Comparable<T>>
      org.hamcrest.Matcher<T>
      greaterThanOrEqualTo​(T value)
      Deprecated.
      Since 3.1.0 use AssertJ based assertions.
      <T> org.hamcrest.Matcher<java.lang.Iterable<? super T>> hasItem​(T item)
      Deprecated.
      Since 3.1.0 use AssertJ based assertions.
      <T> org.hamcrest.Matcher<java.lang.Iterable<T>> hasItems​(T... items)
      Deprecated.
      Since 3.1.0 use AssertJ based assertions.
      <E> org.hamcrest.Matcher<java.util.Collection<? extends E>> hasSize​(int size)
      Deprecated.
      Since 3.1.0 use AssertJ based assertions.
      protected <T> org.hamcrest.Matcher<T> is​(org.eclipse.xtext.xbase.lib.Functions.Function1<? super T,​? extends java.lang.Boolean> predicate)
      Deprecated.
      Since 3.1.0 use AssertJ based assertions.
      <T> org.hamcrest.Matcher<T> is​(org.hamcrest.Matcher<T> matcher)
      Deprecated.
      Since 3.1.0 use AssertJ based assertions.
      <T> org.hamcrest.Matcher<T> is​(T value)
      Deprecated.
      Since 3.1.0 use AssertJ based assertions.
      org.hamcrest.Matcher<java.lang.String> isEqualIgnoringLinebreakStyle​(java.lang.String expectedString)
      Deprecated.
      Since 3.1.0 use AssertJ based assertions.
      <T extends java.lang.Comparable<T>>
      org.hamcrest.Matcher<T>
      lessThan​(T value)
      Deprecated.
      Since 3.1.0 use AssertJ based assertions.
      <T extends java.lang.Comparable<T>>
      org.hamcrest.Matcher<T>
      lessThanOrEqualTo​(T value)
      Deprecated.
      Since 3.1.0 use AssertJ based assertions.
      <T> org.hamcrest.Matcher<T> not​(org.hamcrest.Matcher<T> matcher)
      Deprecated.
      Since 3.1.0 use AssertJ based assertions.
      <T> org.hamcrest.Matcher<T> not​(T value)
      Deprecated.
      Since 3.1.0 use AssertJ based assertions.
      org.hamcrest.Matcher<java.lang.Object> nullValue()
      Deprecated.
      Since 3.1.0 use AssertJ based assertions.
      org.hamcrest.Matcher<java.lang.String> startsWith​(java.lang.String prefix)
      Deprecated.
      Since 3.1.0 use AssertJ based assertions.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • TapirAssertions

        public TapirAssertions()
        Deprecated.
    • Method Detail

      • fail

        @Deprecated
        public void fail​(java.lang.String message)
        Deprecated.
        Since 3.1.0 use AssertJ based assertions.
        Fails a test with the given message.
        Parameters:
        message - the identifying message for the AssertionError (null okay)
        Since:
        2.0.0
        See Also:
        AssertionError
      • assertThat

        @Deprecated
        public <T> void assertThat​(T actual,
                                   org.hamcrest.Matcher<? super T> matcher,
                                   java.lang.String reason)
        Deprecated.
        Since 3.1.0 use AssertJ based assertions.
        Asserts that actual satisfies the condition specified by matcher. If not, an AssertionError is thrown with the reason and information about the matcher and failing value. Example:
           assertThat(0, is(1), "Help! Integers don't work"); // fails:
             // failure message:
             // Help! Integers don't work
             // expected: is <1>
             // got value: <0>
           assertThat(0, is(not(1)), "Zero is one") // passes
         
        org.hamcrest.Matcher does not currently document the meaning of its type parameter T. This method assumes that a matcher typed as Matcher<T> can be meaningfully applied only to values that could be assigned to a variable of type T.
        Type Parameters:
        T - the static type accepted by the matcher (this can flag obvious compile-time problems such as assertThat(1, is("a"))
        Parameters:
        actual - the computed value being compared
        matcher - an expression, built of Matchers, specifying allowed values
        reason - additional information about the error
        Since:
        2.0.0
        See Also:
        CoreMatchers, MatcherAssert
      • assertThat

        @Deprecated
        public <T> void assertThat​(T actual,
                                   org.hamcrest.Matcher<T> matcher)
        Deprecated.
        Since 3.1.0 use AssertJ based assertions.
        Asserts that actual satisfies the condition specified by matcher. If not, an AssertionError is thrown with information about the matcher and failing value. Example:
           assertThat(0, is(1)); // fails:
             // failure message:
             // expected: is <1>
             // got value: <0>
           assertThat(0, is(not(1))) // passes
         
        org.hamcrest.Matcher does not currently document the meaning of its type parameter T. This method assumes that a matcher typed as Matcher<T> can be meaningfully applied only to values that could be assigned to a variable of type T.
        Type Parameters:
        T - the static type accepted by the matcher (this can flag obvious compile-time problems such as assertThat(1, is("a"))
        Parameters:
        actual - the computed value being compared
        matcher - an expression, built of Matchers, specifying allowed values
        Since:
        2.0.0
        See Also:
        CoreMatchers, MatcherAssert
      • assertThat

        @Deprecated
        public void assertThat​(boolean value)
        Deprecated.
        Since 3.1.0 use AssertJ based assertions.
        Asserts that the given value is true.
        Parameters:
        value - the value that should be true
        Since:
        2.0.0
      • assertThat

        @Deprecated
        public void assertThat​(boolean value,
                               java.lang.String reason)
        Deprecated.
        Since 3.1.0 use AssertJ based assertions.
        Asserts that the given value is true.
        Parameters:
        value - the value that should be true
        reason - additional information about the error
        Since:
        2.0.0
      • anyOf

        @Deprecated
        public <T> org.hamcrest.core.AnyOf<T> anyOf​(T... items)
        Deprecated.
        Since 3.1.0 use AssertJ based assertions.
        Creates a matcher that matches if the examined object matches ANY of the specified matchers.

        For example:

        assertThat("myValue", anyOf("a", "b")
        Type Parameters:
        T - the static type accepted by the matcher
        Parameters:
        items - the items to check
        Returns:
        the matcher
        Since:
        2.0.0
      • is

        @Deprecated
        protected <T> org.hamcrest.Matcher<T> is​(org.eclipse.xtext.xbase.lib.Functions.Function1<? super T,​? extends java.lang.Boolean> predicate)
        Deprecated.
        Since 3.1.0 use AssertJ based assertions.
        This method is experimental... please don't use it because of https://bugs.eclipse.org/bugs/show_bug.cgi?id=481450
        Type Parameters:
        T - the static type accepted by the matcher
        Parameters:
        predicate - the predicate to check
        Returns:
        the matcher
        Since:
        2.0.0
      • is

        @Deprecated
        public <T> org.hamcrest.Matcher<T> is​(T value)
        Deprecated.
        Since 3.1.0 use AssertJ based assertions.
        A shortcut to the frequently used is(equalTo(x)).

        For example:

        assertThat(cheese, is(smelly))
        instead of:
        assertThat(cheese, is(equalTo(smelly)))
        Type Parameters:
        T - the static type accepted by the matcher
        Parameters:
        value - the value to check
        Returns:
        the matcher
        Since:
        2.0.0
      • is

        @Deprecated
        public <T> org.hamcrest.Matcher<T> is​(org.hamcrest.Matcher<T> matcher)
        Deprecated.
        Since 3.1.0 use AssertJ based assertions.
        Decorates another Matcher, retaining its behaviour, but allowing tests to be slightly more expressive.

        For example:

        assertThat(cheese, is(equalTo(smelly)))
        instead of:
        assertThat(cheese, equalTo(smelly))
        Type Parameters:
        T - the static type accepted by the matcher
        Parameters:
        matcher - the matcher
        Returns:
        the matcher
        Since:
        2.0.0
      • hasSize

        @Deprecated
        public <E> org.hamcrest.Matcher<java.util.Collection<? extends E>> hasSize​(int size)
        Deprecated.
        Since 3.1.0 use AssertJ based assertions.
        Creates a matcher for Collections that matches when the size() method returns a value equal to the specified size.

        For example:

        assertThat(Arrays.asList("foo", "bar"), hasSize(2))
        Type Parameters:
        E - the type of the collection elements
        Parameters:
        size - the expected size of an examined Collection
        Returns:
        the matcher
        Since:
        2.0.0
      • hasItem

        @Deprecated
        public <T> org.hamcrest.Matcher<java.lang.Iterable<? super T>> hasItem​(T item)
        Deprecated.
        Since 3.1.0 use AssertJ based assertions.
        Creates a matcher for Iterables that only matches when a single pass over the examined Iterable yields at least one item that is equal to the specified item. Whilst matching, the traversal of the examined Iterable will stop as soon as a matching item is found.

        For example:

        assertThat(Arrays.asList("foo", "bar"), hasItem("bar"))
        Type Parameters:
        T - the type iterable elements
        Parameters:
        item - the item to compare against the items provided by the examined Iterable
        Returns:
        the matcher
        Since:
        2.0.0
      • hasItems

        @Deprecated
        public <T> org.hamcrest.Matcher<java.lang.Iterable<T>> hasItems​(T... items)
        Deprecated.
        Since 3.1.0 use AssertJ based assertions.
        Creates a matcher for Iterables that matches when consecutive passes over the examined Iterable yield at least one item that is equal to the corresponding item from the specified items. Whilst matching, each traversal of the examined Iterable will stop as soon as a matching item is found.

        For example:

        assertThat(Arrays.asList("foo", "bar", "baz"), hasItems("baz", "foo"))
        Type Parameters:
        T - the type iterable elements
        Parameters:
        items - the items to compare against the items provided by the examined Iterable
        Returns:
        the matcher
        Since:
        2.0.0
      • containsInAnyOrder

        @Deprecated
        public <T> org.hamcrest.Matcher<java.lang.Iterable<? extends T>> containsInAnyOrder​(T... items)
        Deprecated.
        Since 3.1.0 use AssertJ based assertions.
        Creates an order agnostic matcher for Iterables that matches when a single pass over the examined Iterable yields a series of items, each logically equal to one item anywhere in the specified items. For a positive match, the examined iterable must be of the same length as the number of specified items.

        N.B. each of the specified items will only be used once during a given examination, so be careful when specifying items that may be equal to more than one entry in an examined iterable.

        For example:

        assertThat(Arrays.asList("foo", "bar"), containsInAnyOrder("bar", "foo"))
        Type Parameters:
        T - the type iterable elements
        Parameters:
        items - the items that must equal the items provided by an examined Iterable in any order
        Returns:
        the matcher
        Since:
        2.0.0
      • not

        @Deprecated
        public <T> org.hamcrest.Matcher<T> not​(org.hamcrest.Matcher<T> matcher)
        Deprecated.
        Since 3.1.0 use AssertJ based assertions.
        Creates a matcher that wraps an existing matcher, but inverts the logic by which it will match.

        For example:

        assertThat(cheese, is(not(equalTo(smelly))))
        Type Parameters:
        T - the static type accepted by the matcher
        Parameters:
        matcher - the matcher whose sense should be inverted
        Returns:
        the matcher
        Since:
        2.0.0
      • not

        @Deprecated
        public <T> org.hamcrest.Matcher<T> not​(T value)
        Deprecated.
        Since 3.1.0 use AssertJ based assertions.
        A shortcut to the frequently used not(equalTo(x)).

        For example:

        assertThat(cheese, is(not(smelly)))
        instead of:
        assertThat(cheese, is(not(equalTo(smelly))))
        Type Parameters:
        T - the static type accepted by the matcher
        Parameters:
        value - the value that any examined object should not equal
        Returns:
        the matcher
        Since:
        2.0.0
      • nullValue

        @Deprecated
        public org.hamcrest.Matcher<java.lang.Object> nullValue()
        Deprecated.
        Since 3.1.0 use AssertJ based assertions.
        Creates a matcher that matches if examined object is null.

        For example:

        assertThat(cheese, is(nullValue())
        Returns:
        the matcher
        Since:
        2.0.0
      • containsString

        @Deprecated
        public org.hamcrest.Matcher<java.lang.String> containsString​(java.lang.String substring)
        Deprecated.
        Since 3.1.0 use AssertJ based assertions.
        Creates a matcher that matches if the examined String contains the specified String anywhere.

        For example:

        assertThat("myStringOfNote", containsString("ring"))
        Parameters:
        substring - the substring that the returned matcher will expect to find within any examined string
        Returns:
        the matcher
        Since:
        2.0.0
      • startsWith

        @Deprecated
        public org.hamcrest.Matcher<java.lang.String> startsWith​(java.lang.String prefix)
        Deprecated.
        Since 3.1.0 use AssertJ based assertions.
        Creates a matcher that matches if the examined String starts with the specified String.

        For example:

        assertThat("myStringOfNote", startsWith("my"))
        Parameters:
        prefix - the substring that the returned matcher will expect at the start of any examined string
        Returns:
        the matcher
        Since:
        2.0.0
      • endsWith

        @Deprecated
        public org.hamcrest.Matcher<java.lang.String> endsWith​(java.lang.String suffix)
        Deprecated.
        Since 3.1.0 use AssertJ based assertions.
        Creates a matcher that matches if the examined String ends with the specified String.

        For example:

        assertThat("myStringOfNote", endsWith("Note"))
        Parameters:
        suffix - the substring that the returned matcher will expect at the end of any examined string
        Returns:
        the matcher
        Since:
        2.0.0
      • greaterThan

        @Deprecated
        public <T extends java.lang.Comparable<T>> org.hamcrest.Matcher<T> greaterThan​(T value)
        Deprecated.
        Since 3.1.0 use AssertJ based assertions.
        Creates a matcher of Comparable object that matches when the examined object is greater than the specified value, as reported by the compareTo method of the examined object.

        For example:

        assertThat(2, greaterThan(1))
        Type Parameters:
        T - the static type accepted by the matcher
        Parameters:
        value - the value which, when passed to the compareTo method of the examined object, should return greater than zero
        Returns:
        the matcher
        Since:
        2.0.0
      • greaterThanOrEqualTo

        @Deprecated
        public <T extends java.lang.Comparable<T>> org.hamcrest.Matcher<T> greaterThanOrEqualTo​(T value)
        Deprecated.
        Since 3.1.0 use AssertJ based assertions.
        Creates a matcher of Comparable object that matches when the examined object is greater than or equal to the specified value, as reported by the compareTo method of the examined object.

        For example:

        assertThat(1, greaterThanOrEqualTo(1))
        Type Parameters:
        T - the static type accepted by the matcher
        Parameters:
        value - the value which, when passed to the compareTo method of the examined object, should return greater than or equal to zero
        Returns:
        the matcher
        Since:
        2.0.0
      • lessThan

        @Deprecated
        public <T extends java.lang.Comparable<T>> org.hamcrest.Matcher<T> lessThan​(T value)
        Deprecated.
        Since 3.1.0 use AssertJ based assertions.
        Creates a matcher of Comparable object that matches when the examined object is less than the specified value, as reported by the compareTo method of the examined object.

        For example:

        assertThat(1, lessThan(2))
        Type Parameters:
        T - the static type accepted by the matcher
        Parameters:
        value - the value which, when passed to the compareTo method of the examined object, should return less than zero
        Returns:
        the matcher
        Since:
        2.0.0
      • lessThanOrEqualTo

        @Deprecated
        public <T extends java.lang.Comparable<T>> org.hamcrest.Matcher<T> lessThanOrEqualTo​(T value)
        Deprecated.
        Since 3.1.0 use AssertJ based assertions.
        Creates a matcher of Comparable object that matches when the examined object is less than or equal to the specified value, as reported by the compareTo method of the examined object.

        For example:

        assertThat(1, lessThanOrEqualTo(1))
        Type Parameters:
        T - the static type accepted by the matcher
        Parameters:
        value - the value which, when passed to the compareTo method of the examined object, should return less than or equal to zero
        Returns:
        the matcher
        Since:
        2.0.0
      • isEqualIgnoringLinebreakStyle

        @Deprecated
        public org.hamcrest.Matcher<java.lang.String> isEqualIgnoringLinebreakStyle​(java.lang.String expectedString)
        Deprecated.
        Since 3.1.0 use AssertJ based assertions.
        Matcher which ignores \r\n differences.
        Parameters:
        expectedString - the expected string
        Returns:
        the matcher
        Since:
        2.0.0