DefaultQueryDescriptor implements QueryDescriptor { @Override public String toString() { return (getFunction() != null ? getFunction() + " " : "") + (isDistinct() ? "distinct " : "") + getBranches(); } 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 testToString() { final QueryDescriptor noFunctionNotDistinct = new DefaultQueryDescriptor(false, null, 0, null, null, Collections.emptyList(), null, null); assertThat(noFunctionNotDistinct.toString(), is("[]")); final QueryDescriptor functionNotDistinct = new DefaultQueryDescriptor(false, "xyz", 0, null, null, Collections.emptyList(), null, null); assertThat(functionNotDistinct.toString(), is("xyz []")); final QueryDescriptor functionDistinct = new DefaultQueryDescriptor(true, "xyz", 0, null, null, Collections.emptyList(), null, null); assertThat(functionDistinct.toString(), is("xyz distinct []")); }