use of org.springframework.data.projection.SpelAwareProxyProjectionFactory in project spring-data-commons by spring-projects.
the class ResultProcessorUnitTests method leavesNonProjectingResultUntouched.
// DATACMNS-89
@Test
public void leavesNonProjectingResultUntouched() throws Exception {
ResultProcessor information = new ResultProcessor(getQueryMethod("findAll"), new SpelAwareProxyProjectionFactory());
Sample sample = new Sample("Dave", "Matthews");
List<Sample> result = new ArrayList<>(Collections.singletonList(sample));
List<Sample> converted = information.processResult(result);
assertThat(converted).contains(sample);
}
use of org.springframework.data.projection.SpelAwareProxyProjectionFactory in project spring-data-commons by spring-projects.
the class ReturnedTypeUnitTests method cachesInstancesBySourceTypes.
// DATACMNS-1112
@Test
public void cachesInstancesBySourceTypes() {
SpelAwareProxyProjectionFactory factory = new SpelAwareProxyProjectionFactory();
ReturnedType left = ReturnedType.of(Child.class, Object.class, factory);
ReturnedType right = ReturnedType.of(Child.class, Object.class, factory);
assertThat(left).isSameAs(right);
}
use of org.springframework.data.projection.SpelAwareProxyProjectionFactory in project spring-data-commons by spring-projects.
the class ReturnedTypeUnitTests method detectsDistinctInputProperties.
// DATACMNS-963
@Test
public void detectsDistinctInputProperties() {
ReturnedType type = ReturnedType.of(Child.class, Object.class, new SpelAwareProxyProjectionFactory());
List<String> properties = type.getInputProperties();
assertThat(properties).hasSize(1);
assertThat(properties).containsExactly("firstname");
}
use of org.springframework.data.projection.SpelAwareProxyProjectionFactory in project spring-data-commons by spring-projects.
the class QueryExecutorMethodInterceptorUnitTests method skipsQueryLookupsIfQueryLookupStrategyIsNotPresent.
@Test
public void skipsQueryLookupsIfQueryLookupStrategyIsNotPresent() {
when(information.getQueryMethods()).thenReturn(Streamable.empty());
when(factory.getQueryLookupStrategy(any(), any())).thenReturn(Optional.of(strategy));
factory.new QueryExecutorMethodInterceptor(information, new SpelAwareProxyProjectionFactory());
verify(strategy, times(0)).resolveQuery(any(), any(), any(), any());
}
use of org.springframework.data.projection.SpelAwareProxyProjectionFactory in project spring-data-commons by spring-projects.
the class QueryExecutorMethodInterceptorUnitTests method rejectsRepositoryInterfaceWithQueryMethodsIfNoQueryLookupStrategyIsDefined.
@Test(expected = IllegalStateException.class)
public void rejectsRepositoryInterfaceWithQueryMethodsIfNoQueryLookupStrategyIsDefined() throws Exception {
when(information.hasQueryMethods()).thenReturn(true);
when(factory.getQueryLookupStrategy(any(), any())).thenReturn(Optional.empty());
factory.new QueryExecutorMethodInterceptor(information, new SpelAwareProxyProjectionFactory());
}
Aggregations