Class TCKMatchers
java.lang.Object
org.eclipse.microprofile.openapi.tck.utils.TCKMatchers
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic class -
Method Summary
Modifier and TypeMethodDescriptionstatic org.hamcrest.Matcher<Number>comparesEqualToNumber(Number expected) Creates a matcher ofComparable<Number>that matches when the examined number is equal to the specified value, as reported by thecompareTomethod of theBigDecimals created by passing both Number values'doubleValuetoBigDecimal.valueOf(double).static <T> org.hamcrest.Matcher<T>hasOptionalEntry(String entryName, Object value) Creates a matcher which matches a map entry with an allowed value or the absence of a map entry from the object.static org.hamcrest.Matcher<Object>itemOrSingleton(Object item) Creates a matcher which matches an item or aCollectioncontaining just that itemstatic org.hamcrest.Matcher<Object>itemOrSingleton(org.hamcrest.Matcher<?> itemMatcher) Creates a matcher which matches an item or aCollectioncontaining just that itemstatic org.hamcrest.Matcher<Number>Creates a matcher which matches numbers based on their numeric value without considering their type.
-
Method Details
-
comparesEqualToNumber
Creates a matcher ofComparable<Number>that matches when the examined number is equal to the specified value, as reported by thecompareTomethod of theBigDecimals created by passing both Number values'doubleValuetoBigDecimal.valueOf(double).For example:
assertThat(1, comparesEqualToNumber(1))
- Parameters:
expected- the value which, when passed to the compareTo method of the examined object following conversion to BigDecimal, should return zero- Returns:
- a matcher to test the equality of the examined Number
-
itemOrSingleton
Creates a matcher which matches an item or aCollectioncontaining just that item- Parameters:
itemMatcher- the matcher for the item- Returns:
- the matcher
-
itemOrSingleton
Creates a matcher which matches an item or aCollectioncontaining just that item- Parameters:
item- the item- Returns:
- the matcher
-
number
Creates a matcher which matches numbers based on their numeric value without considering their type.Both the expected and actual value are converted to
BigDecimaland compared usingcompareTo.- Parameters:
number- the expected number- Returns:
- the matcher
-
hasOptionalEntry
Creates a matcher which matches a map entry with an allowed value or the absence of a map entry from the object.- Parameters:
entryName- name of the entry in the mapvalue- a single allowed value in the map entry, if present- Returns:
- the matcher
-