org.hamcrest.number.OrderingComparison类的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(10.5k)|赞(0)|评价(0)|浏览(86)

本文整理了Java中org.hamcrest.number.OrderingComparison类的一些代码示例,展示了OrderingComparison类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。OrderingComparison类的具体详情如下:
包路径:org.hamcrest.number.OrderingComparison
类名称:OrderingComparison

OrderingComparison介绍

暂无

代码示例

代码示例来源:origin: hamcrest/JavaHamcrest

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);
}

代码示例来源:origin: hamcrest/JavaHamcrest

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));
}

代码示例来源:origin: hamcrest/JavaHamcrest

public void testAllowsForInclusiveComparisons() {
  assertThat("less", 1, lessThanOrEqualTo(1));
  assertThat("greater", 1, greaterThanOrEqualTo(1));
}

代码示例来源:origin: hamcrest/JavaHamcrest

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")));
}

代码示例来源:origin: pholser/junit-quickcheck

@Property public void shouldHold(@InRange(min = "2.71", max = "3.14") Double d) {
    assertThat(d, allOf(greaterThanOrEqualTo(2.71), lessThan(3.14)));
  }
}

代码示例来源:origin: org.hamcrest/hamcrest-all

/**
 * 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);
}

代码示例来源:origin: org.hamcrest/hamcrest-all

/**
 * 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);
}

代码示例来源:origin: schemacrawler/SchemaCrawler

/**
 * 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));
}

代码示例来源:origin: cloudfoundry/uaa

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));

代码示例来源:origin: org.hamcrest/hamcrest-all

/**
 * 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);
}

代码示例来源:origin: org.hamcrest/hamcrest-all

/**
 * 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);
}

代码示例来源:origin: org.hamcrest/hamcrest-all

/**
 * 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);
}

代码示例来源:origin: pholser/junit-quickcheck

@Property public void shouldHold(@InRange(minDouble = -2.71, maxDouble = 3.14) double d) {
    assertThat(d, allOf(greaterThanOrEqualTo(-2.71), lessThan(3.14)));
  }
}

代码示例来源:origin: hamcrest/JavaHamcrest

/**
 * 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);
}

代码示例来源:origin: hamcrest/JavaHamcrest

public void testAllowsForInclusiveComparisons() {
  assertThat("less", 1, lessThanOrEqualTo(1));
  assertThat("greater", 1, greaterThanOrEqualTo(1));
}

代码示例来源:origin: hamcrest/JavaHamcrest

/**
 * 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);
}

代码示例来源:origin: hamcrest/JavaHamcrest

/**
 * 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);
}

代码示例来源:origin: hamcrest/JavaHamcrest

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")));
}

代码示例来源:origin: hamcrest/JavaHamcrest

/**
 * 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);
}

代码示例来源:origin: hamcrest/JavaHamcrest

/**
 * 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);
}

相关文章