DATACOUCH-214 - Adding case insensitive sorting

Closes #105
This commit is contained in:
James Thomson
2016-03-10 19:31:52 +00:00
committed by Simon Baslé
parent ee58b4d6e4
commit 0149144bc0
4 changed files with 38 additions and 2 deletions

View File

@@ -101,6 +101,22 @@ public class N1qlUtilsTest {
verifyZeroInteractions(converter);
}
@Test
public void testCreateSortIgnoresCaseWhenSpecified() throws Exception {
CouchbaseConverter converter = mock(CouchbaseConverter.class);
Sort sortDescription = new Sort(
new Sort.Order(Sort.Direction.ASC, "description").ignoreCase(),
new Sort.Order(Sort.Direction.ASC, "attendees")
);
com.couchbase.client.java.query.dsl.Sort[] realSort = N1qlUtils.createSort(sortDescription, converter);
assertEquals(2, realSort.length);
assertEquals(com.couchbase.client.java.query.dsl.Sort.asc("LOWER(TOSTRING(`description`))").toString(), realSort[0].toString());
assertEquals(com.couchbase.client.java.query.dsl.Sort.asc("`attendees`").toString(), realSort[1].toString());
verifyZeroInteractions(converter);
}
@Test
public void testCreateCountQueryForEntity() throws Exception {
CouchbaseConverter converter = mock(CouchbaseConverter.class);