Restrictions { protected static Integer[] range(int from, int to) { if (from > to) { throw new IllegalArgumentException("from must be <= to (" + from + "," + to + ")"); } int n = to - from + 1; Integer[] range = new Integer[n]; for (int i = 0; i < n; i++) { range[i] = from + i; } return range; } private  Restrictions(); static EqualityExpression eq(String propertyName, Object value); static EqualityExpression ne(String propertyName, Object value); static EqualityExpression lt(String propertyName, Object value); static EqualityExpression lte(String propertyName, Object value); static EqualityExpression gt(String propertyName, Object value); static EqualityExpression gte(String propertyName, Object value); static RangeExpression between(String propertyName, Object from, Object to); static SetExpression discreteRange(String propertyName, int from, int to); static SetExpression in(String propertyName, Object[] values); static SetExpression in(String propertyName, Collection<? extends Object> values); static SetExpression notIn(String propertyName, Object[] values); static SetExpression notIn(String propertyName, Collection<? extends Object> values); static SetExpression contains(String propertyName, Object value); static SetExpression contains(String propertyName, Object[] values); static UnaryExpression isNull(String propertyName); static UnaryExpression isNotNull(String propertyName); static UnaryExpression isEmpty(String propertyName); static UnaryExpression isNotEmpty(String propertyName); static NativeExpression nativeQuery(Class<T> type, T expression); static Conjunction and(Criterion... criteria); static Disjunction or(Criterion... criteria); static Distance2dExpression<N> within(
            String propertyName, N x, N y, N distance);  }
@Test public void range() { assertArrayEquals(new Integer[] { 10, 11, 12, 13, 14, 15, 16, 17 }, Restrictions.range(10, 17)); }
@Test public void range_one() { assertArrayEquals(new Integer[] { 10 }, Restrictions.range(10, 10)); }
@Test(expected = IllegalArgumentException.class) public void range_IllegalArgumentException() { Restrictions.range(17, 10); }