TableBuilder implements Table { @Override public Table withRowsBetween(final long from, final long to) { Preconditions.checkArgument(from >= 0, "Parameter from should be >= 0"); Preconditions.checkArgument(to >= 0, "Parameter to should be >= 0"); Preconditions.checkArgument(from <= to, "Parameter 'from' should be less than or equal to parameter 'to', but %s<=%s is not true.", from, to); for (long i = from; i <= to; i++) { this.rows.add(Daleq.aRow(i)); } return this; } TableBuilder(final TableTypeReference tableRef); @Override Table with(final Row... rows); @Override Table withSomeRows(final Iterable<Long> ids); @Override Table withSomeRows(final long... ids); @Override Table withRowsBetween(final long from, final long to); @Override Table allHaving(final FieldTypeReference field, @Nullable final Object value); @Override Table having(final FieldTypeReference field, final Object... values); @Override Table havingFrom(final FieldTypeReference field, final Iterable<T> values); @Override TableData build(final Context context);  }
@Test(expected = IllegalArgumentException.class) public void aTableWithRowsBetween_butFromLessThanTo_should_fail() { aTable(ExampleTable.class).withRowsBetween(10, 9); }
@Test(expected = IllegalArgumentException.class) public void aTableWithRowsBetween_butFromIsLessZero_should_fail() { aTable(ExampleTable.class).withRowsBetween(-1, 10); }
@Test(expected = IllegalArgumentException.class) public void aTableWithRowsBetween_butToIsLessZero_should_fail() { aTable(ExampleTable.class).withRowsBetween(0, -1); }