// tests
@Test
public final void whenSortingByStringNullLast_thenLastNull() {
service.create(new Foo());
service.create(new Foo(randomAlphabetic(6)));
final String jql = "Select f from Foo as f order by f.name desc NULLS LAST";
final Query sortQuery = entityManager.createQuery(jql);
final List<Foo> fooList = sortQuery.getResultList();
assertNull(fooList.get(fooList.toArray().length - 1).getName());