DATAJDBC-530 - The sorting property set as the property name.

Original pull request: #210.
This commit is contained in:
mhyeon-lee
2020-05-04 01:47:40 +09:00
committed by Jens Schauder
parent 8c70bbf7e0
commit f9bc40cc46
2 changed files with 12 additions and 4 deletions

View File

@@ -59,6 +59,7 @@ import org.springframework.data.relational.core.sql.Table;
* @author Mark Paluch
* @author Tom Hombergs
* @author Milan Milanov
* @author Myeonghyeon Lee
*/
public class SqlGeneratorUnitTests {
@@ -177,7 +178,7 @@ public class SqlGeneratorUnitTests {
@Test // DATAJDBC-101
public void findAllSortedBySingleField() {
String sql = sqlGenerator.getFindAll(Sort.by("x_name"));
String sql = sqlGenerator.getFindAll(Sort.by("name"));
assertThat(sql).contains("SELECT", //
"dummy_entity.id1 AS id1", //
@@ -197,7 +198,7 @@ public class SqlGeneratorUnitTests {
public void findAllSortedByMultipleFields() {
String sql = sqlGenerator.getFindAll(
Sort.by(new Sort.Order(Sort.Direction.DESC, "x_name"), new Sort.Order(Sort.Direction.ASC, "x_other")));
Sort.by(new Sort.Order(Sort.Direction.DESC, "name"), new Sort.Order(Sort.Direction.ASC, "other")));
assertThat(sql).contains("SELECT", //
"dummy_entity.id1 AS id1", //
@@ -245,7 +246,7 @@ public class SqlGeneratorUnitTests {
@Test // DATAJDBC-101
public void findAllPagedAndSorted() {
String sql = sqlGenerator.getFindAll(PageRequest.of(3, 10, Sort.by("x_name")));
String sql = sqlGenerator.getFindAll(PageRequest.of(3, 10, Sort.by("name")));
assertThat(sql).contains("SELECT", //
"dummy_entity.id1 AS id1", //