public void testMismatchDescriptions() { assertMismatchDescription("<0> was less than <1>", greaterThan(1), 0); assertMismatchDescription("<1> was equal to <1>", greaterThan(1), 1); assertMismatchDescription("<1> was greater than <0>", lessThan(0), 1); assertMismatchDescription("<2> was equal to <2>", lessThan(2), 2); }
public void testDescription() { assertDescription("a value greater than <1>", greaterThan(1)); assertDescription("a value equal to or greater than <1>", greaterThanOrEqualTo(1)); assertDescription("a value equal to <1>", comparesEqualTo(1)); assertDescription("a value less than or equal to <1>", lessThanOrEqualTo(1)); assertDescription("a value less than <1>", lessThan(1)); }
public void testAllowsForInclusiveComparisons() { assertThat("less", 1, lessThanOrEqualTo(1)); assertThat("greater", 1, greaterThanOrEqualTo(1)); }
public void testComparesBigDecimalsWithDifferentScalesCorrectlyForIssue20() { assertThat(new BigDecimal("10.0"), greaterThanOrEqualTo(new BigDecimal("10"))); assertThat(new BigDecimal(10), greaterThanOrEqualTo(new BigDecimal("10.0"))); assertThat(new BigDecimal("2"), comparesEqualTo(new BigDecimal("2.000"))); }
@Property public void shouldHold(@InRange(min = "2.71", max = "3.14") Double d) { assertThat(d, allOf(greaterThanOrEqualTo(2.71), lessThan(3.14))); } }
/** * Creates a matcher of {@link Comparable} object that matches when the examined object is * greater than the specified value, as reported by the <code>compareTo</code> method of the * <b>examined</b> object. * <p/> * For example: * <pre>assertThat(2, greaterThan(1))</pre> * * @param value * the value which, when passed to the compareTo method of the examined object, should return greater * than zero */ public static <T extends java.lang.Comparable<T>> org.hamcrest.Matcher<T> greaterThan(T value) { return org.hamcrest.number.OrderingComparison.<T>greaterThan(value); }
/** * Creates a matcher of {@link Comparable} object that matches when the examined object is * less than the specified value, as reported by the <code>compareTo</code> method of the * <b>examined</b> object. * <p/> * For example: * <pre>assertThat(1, lessThan(2))</pre> * * @param value * the value which, when passed to the compareTo method of the examined object, should return less * than zero */ public static <T extends java.lang.Comparable<T>> org.hamcrest.Matcher<T> lessThan(T value) { return org.hamcrest.number.OrderingComparison.<T>lessThan(value); }
/** * See: <a href= * "https://github.com/schemacrawler/SchemaCrawler/issues/228">Inconsistent * table comparison</a> */ @Test public void compareTables() { final MutableTable tbl = new MutableTable(new SchemaReference(null, "public"), "booking_detail"); tbl.setTableType(new TableType("table")); final MutableView view = new MutableView(new SchemaReference(null, "public"), "blog_monthly_stat_fa"); view.setTableType(new TableType("materialized view")); assertThat(view, lessThan(null)); assertThat(tbl, lessThan(null)); assertThat(tbl, comparesEqualTo(tbl)); assertThat(view, comparesEqualTo(view)); assertThat(tbl, lessThan(view)); assertThat(view, greaterThan(tbl)); }
assertTrue("Token should be composite token", accessToken instanceof CompositeToken); CompositeToken composite = (CompositeToken) accessToken; assertThat("id_token should be JWT, thus longer than 36 characters", composite.getIdTokenValue().length(), greaterThan(36)); assertThat("Opaque access token must be shorter than 37 characters", accessToken.getValue().length(), lessThanOrEqualTo(36)); assertThat("Opaque refresh token must be shorter than 37 characters", accessToken.getRefreshToken().getValue().length(), lessThanOrEqualTo(36)); params.put("token_format", OPAQUE.getStringValue()); OAuth2AccessToken newAccessToken = tokenServices.refreshAccessToken(composite.getRefreshToken().getValue(), new TokenRequest(params, CLIENT_ID, Collections.EMPTY_SET, "refresh_token")); assertThat("Opaque access token must be shorter than 37 characters", newAccessToken.getValue().length(), lessThanOrEqualTo(36)); assertThat("Opaque refresh token must be shorter than 37 characters", newAccessToken.getRefreshToken().getValue().length(), lessThanOrEqualTo(36));
/** * Creates a matcher of {@link Comparable} object that matches when the examined object is * less than or equal to the specified value, as reported by the <code>compareTo</code> method * of the <b>examined</b> object. * <p/> * For example: * <pre>assertThat(1, lessThanOrEqualTo(1))</pre> * * @param value * the value which, when passed to the compareTo method of the examined object, should return less * than or equal to zero */ public static <T extends java.lang.Comparable<T>> org.hamcrest.Matcher<T> lessThanOrEqualTo(T value) { return org.hamcrest.number.OrderingComparison.<T>lessThanOrEqualTo(value); }
/** * Creates a matcher of {@link Comparable} object that matches when the examined object is * greater than or equal to the specified value, as reported by the <code>compareTo</code> method * of the <b>examined</b> object. * <p/> * For example: * <pre>assertThat(1, greaterThanOrEqualTo(1))</pre> * * @param value * the value which, when passed to the compareTo method of the examined object, should return greater * than or equal to zero */ public static <T extends java.lang.Comparable<T>> org.hamcrest.Matcher<T> greaterThanOrEqualTo(T value) { return org.hamcrest.number.OrderingComparison.<T>greaterThanOrEqualTo(value); }
/** * Creates a matcher of {@link Comparable} object that matches when the examined object is * equal to the specified value, as reported by the <code>compareTo</code> method of the * <b>examined</b> object. * <p/> * For example: * <pre>assertThat(1, comparesEqualTo(1))</pre> * * @param value * the value which, when passed to the compareTo method of the examined object, should return zero */ public static <T extends java.lang.Comparable<T>> org.hamcrest.Matcher<T> comparesEqualTo(T value) { return org.hamcrest.number.OrderingComparison.<T>comparesEqualTo(value); }
@Property public void shouldHold(@InRange(minDouble = -2.71, maxDouble = 3.14) double d) { assertThat(d, allOf(greaterThanOrEqualTo(-2.71), lessThan(3.14))); } }
/** * Creates a matcher of {@link Comparable} object that matches when the examined object is * greater than the specified value, as reported by the <code>compareTo</code> method of the * <b>examined</b> object. * For example: * <pre>assertThat(2, greaterThan(1))</pre> * * @param value the value which, when passed to the compareTo method of the examined object, should return greater * than zero */ public static <T extends java.lang.Comparable<T>> org.hamcrest.Matcher<T> greaterThan(T value) { return org.hamcrest.number.OrderingComparison.greaterThan(value); }
public void testAllowsForInclusiveComparisons() { assertThat("less", 1, lessThanOrEqualTo(1)); assertThat("greater", 1, greaterThanOrEqualTo(1)); }
/** * Creates a matcher of {@link Comparable} object that matches when the examined object is * less than the specified value, as reported by the <code>compareTo</code> method of the * <b>examined</b> object. * For example: * <pre>assertThat(1, lessThan(2))</pre> * * @param value the value which, when passed to the compareTo method of the examined object, should return less * than zero */ public static <T extends java.lang.Comparable<T>> org.hamcrest.Matcher<T> lessThan(T value) { return org.hamcrest.number.OrderingComparison.lessThan(value); }
/** * Creates a matcher of {@link Comparable} object that matches when the examined object is * less than or equal to the specified value, as reported by the <code>compareTo</code> method * of the <b>examined</b> object. * For example: * <pre>assertThat(1, lessThanOrEqualTo(1))</pre> * * @param value the value which, when passed to the compareTo method of the examined object, should return less * than or equal to zero */ public static <T extends java.lang.Comparable<T>> org.hamcrest.Matcher<T> lessThanOrEqualTo(T value) { return org.hamcrest.number.OrderingComparison.lessThanOrEqualTo(value); }
public void testComparesBigDecimalsWithDifferentScalesCorrectlyForIssue20() { assertThat(new BigDecimal("10.0"), greaterThanOrEqualTo(new BigDecimal("10"))); assertThat(new BigDecimal(10), greaterThanOrEqualTo(new BigDecimal("10.0"))); assertThat(new BigDecimal("2"), comparesEqualTo(new BigDecimal("2.000"))); }
/** * Creates a matcher of {@link Comparable} object that matches when the examined object is * greater than or equal to the specified value, as reported by the <code>compareTo</code> method * of the <b>examined</b> object. * For example: * <pre>assertThat(1, greaterThanOrEqualTo(1))</pre> * * @param value the value which, when passed to the compareTo method of the examined object, should return greater * than or equal to zero */ public static <T extends java.lang.Comparable<T>> org.hamcrest.Matcher<T> greaterThanOrEqualTo(T value) { return org.hamcrest.number.OrderingComparison.greaterThanOrEqualTo(value); }
/** * Creates a matcher of {@link Comparable} object that matches when the examined object is * equal to the specified value, as reported by the <code>compareTo</code> method of the * <b>examined</b> object. * For example: * <pre>assertThat(1, comparesEqualTo(1))</pre> * * @param value the value which, when passed to the compareTo method of the examined object, should return zero */ public static <T extends java.lang.Comparable<T>> org.hamcrest.Matcher<T> comparesEqualTo(T value) { return org.hamcrest.number.OrderingComparison.comparesEqualTo(value); }