/** * 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); }
/** * 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); }
public void testComparesObjectsForEquality() { assertThat(3, comparesEqualTo(3)); assertThat("aa", comparesEqualTo("aa")); }
public void testComparesObjectsForEquality() { assertThat(3, comparesEqualTo(3)); assertThat("aa", comparesEqualTo("aa")); }
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"))); }
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 * 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); }
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 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)); }
@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)); }
/** * 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); }
/** * 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)); }