本文整理了Java中org.hamcrest.number.OrderingComparison.comparesEqualTo()
方法的一些代码示例,展示了OrderingComparison.comparesEqualTo()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。OrderingComparison.comparesEqualTo()
方法的具体详情如下:
包路径:org.hamcrest.number.OrderingComparison
类名称:OrderingComparison
方法名:comparesEqualTo
[英]Creates a matcher of Comparable object that matches when the examined object is equal to the specified value, as reported by the compareTo
method of the examined object. For example:
assertThat(1, comparesEqualTo(1))
[中]创建可比较对象的匹配器,该匹配器在被检查对象等于被检查对象的compareTo
方法报告的指定值时匹配。例如:
assertThat(1, comparesEqualTo(1))
代码示例来源: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: 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);
}
代码示例来源:origin: hamcrest/JavaHamcrest
public void testComparesObjectsForEquality() {
assertThat(3, comparesEqualTo(3));
assertThat("aa", comparesEqualTo("aa"));
}
代码示例来源:origin: hamcrest/JavaHamcrest
public void testComparesObjectsForEquality() {
assertThat(3, comparesEqualTo(3));
assertThat("aa", comparesEqualTo("aa"));
}
代码示例来源: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
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: org.hamcrest/java-hamcrest
/**
* 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.<T>comparesEqualTo(value);
}
代码示例来源: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 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: schemacrawler/SchemaCrawler
@Test
public void tableTypeCompare1()
throws Exception
{
final TableType tableType1 = new TableType("table");
final TableType tableType2 = new TableType("table");
assertThat(tableType1, comparesEqualTo(tableType2));
assertThat(tableType2, comparesEqualTo(tableType1));
assertThat(tableType1, equalTo(tableType2));
}
代码示例来源:origin: org.hamcrest/hamcrest
/**
* 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);
}
代码示例来源: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));
}
内容来源于网络,如有侵权,请联系作者删除!