Search in sources :

Example 1 with ReflectionEquals

use of org.mockito.internal.matchers.apachecommons.ReflectionEquals in project sharding-jdbc by dangdangdotcom.

the class AbstractBaseParseTest method assertMergeContext.

private void assertMergeContext(final SQLParsedResult actual) {
    for (OrderByColumn each : actual.getMergeContext().getOrderByColumns()) {
        assertThat(each, new ReflectionEquals(orderByColumns.next()));
    }
    assertFalse(orderByColumns.hasNext());
    for (GroupByColumn each : actual.getMergeContext().getGroupByColumns()) {
        assertThat(each, new ReflectionEquals(groupByColumns.next()));
    }
    assertFalse(groupByColumns.hasNext());
    for (AggregationColumn each : actual.getMergeContext().getAggregationColumns()) {
        AggregationColumn expected = aggregationColumns.next();
        assertThat(each, new ReflectionEquals(expected, "derivedColumns"));
        for (int i = 0; i < each.getDerivedColumns().size(); i++) {
            assertThat(each.getDerivedColumns().get(i), new ReflectionEquals(expected.getDerivedColumns().get(i)));
        }
    }
    assertFalse(aggregationColumns.hasNext());
    assertThat(actual.getMergeContext().getLimit(), new ReflectionEquals(limit));
}
Also used : AggregationColumn(com.dangdang.ddframe.rdb.sharding.parser.result.merger.AggregationColumn) ReflectionEquals(org.mockito.internal.matchers.apachecommons.ReflectionEquals) GroupByColumn(com.dangdang.ddframe.rdb.sharding.parser.result.merger.GroupByColumn) OrderByColumn(com.dangdang.ddframe.rdb.sharding.parser.result.merger.OrderByColumn)

Example 2 with ReflectionEquals

use of org.mockito.internal.matchers.apachecommons.ReflectionEquals in project sharding-jdbc by dangdangdotcom.

the class AbstractBaseParseTest method assertRouteContext.

private void assertRouteContext(final SQLParsedResult actual) {
    assertThat(actual.getRouteContext().getSqlBuilder().toString(), is(expectedSQL));
    for (Table each : actual.getRouteContext().getTables()) {
        assertThat(each, new ReflectionEquals(expectedTables.next()));
    }
    assertFalse(expectedTables.hasNext());
}
Also used : Table(com.dangdang.ddframe.rdb.sharding.parser.result.router.Table) ReflectionEquals(org.mockito.internal.matchers.apachecommons.ReflectionEquals)

Aggregations

ReflectionEquals (org.mockito.internal.matchers.apachecommons.ReflectionEquals)2 AggregationColumn (com.dangdang.ddframe.rdb.sharding.parser.result.merger.AggregationColumn)1 GroupByColumn (com.dangdang.ddframe.rdb.sharding.parser.result.merger.GroupByColumn)1 OrderByColumn (com.dangdang.ddframe.rdb.sharding.parser.result.merger.OrderByColumn)1 Table (com.dangdang.ddframe.rdb.sharding.parser.result.router.Table)1