DATACMNS-641 - Order clauses in derived repository clauses now default to ascending order.

OrderBySource now considers the Asc and Desc keywords in an OrderBy-clause optional defaulting to ascending order as Sort defaults to anyway.
This commit is contained in:
Oliver Gierke
2015-02-04 12:06:58 +01:00
parent 2b4d173320
commit bff8caba75
2 changed files with 33 additions and 8 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2008-2010 the original author or authors.
* Copyright 2008-2015 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -60,7 +60,16 @@ public class OrderBySourceUnitTests {
OrderBySource source = new OrderBySource("BarNameDesc", Foo.class);
assertThat(source.toSort(), is(new Sort(new Order(DESC, "bar.name"))));
}
/**
* @see DATACMNS-641
*/
@Test
public void defaultsSortOrderToAscendingSort() {
OrderBySource source = new OrderBySource("lastname");
assertThat(source.toSort(), is(new Sort("lastname")));
}
@SuppressWarnings("unused")