DefaultQueryDescriptor implements QueryDescriptor { @Override public Sort getSort(Invocation invocation) { return sortExtractor == null ? null : sortExtractor.extract(invocation); } DefaultQueryDescriptor(boolean distinct, String function, int limit, PageParameterExtractor pageExtractor,
                                  SortParameterExtractor sortExtractor, List<List<Parameter>> branches,
                                  RepositoryFactoryConfiguration configuration, RepositoryMetadata repositoryMetadata); @Override RepositoryFactoryConfiguration getConfiguration(); @Override RepositoryMetadata getRepositoryMetadata(); @Override boolean isDistinct(); @Override String getFunction(); @Override int getLimit(); @Override Page getPage(Invocation invocation); @Override Sort getSort(Invocation invocation); @Override List<List<Parameter>> getBranches(); @Override boolean matches(Object entity, Invocation invocation); @Override String toString();  }
@Test public void testGettingSortWhenSortExtractorIsNull() { final DefaultQueryDescriptor descriptor = new DefaultQueryDescriptor(false, null, 0, null, null, null, null, null); assertThat(descriptor.getSort(new ImmutableInvocation(null, new Object[]{})), is(nullValue())); }