use of org.springframework.data.repository.support.CrudRepositoryInvokerUnitTests.PersonRepository in project spring-data-commons by spring-projects.
the class ReflectionRepositoryInvokerUnitTests method considersFormattingAnnotationsOnQueryMethodParameters.
// DATACMNS-589
@Test
public void considersFormattingAnnotationsOnQueryMethodParameters() throws Exception {
MultiValueMap<String, String> parameters = new LinkedMultiValueMap<>();
parameters.add("date", "2013-07-18T10:49:00.000+02:00");
Method method = PersonRepository.class.getMethod("findByCreatedUsingISO8601Date", Date.class, Pageable.class);
PersonRepository repository = mock(PersonRepository.class);
getInvokerFor(repository, expectInvocationOf(method)).invokeQueryMethod(method, parameters, Pageable.unpaged(), Sort.unsorted());
}
use of org.springframework.data.repository.support.CrudRepositoryInvokerUnitTests.PersonRepository in project spring-data-commons by spring-projects.
the class ReflectionRepositoryInvokerUnitTests method translatesCollectionRequestParametersCorrectly.
// DATACMNS-647
@Test
public void translatesCollectionRequestParametersCorrectly() throws Exception {
for (String[] ids : Arrays.asList(new String[] { "1,2" }, new String[] { "1", "2" })) {
MultiValueMap<String, String> parameters = new LinkedMultiValueMap<>();
parameters.put("ids", Arrays.asList(ids));
Method method = PersonRepository.class.getMethod("findByIdIn", Collection.class);
PersonRepository repository = mock(PersonRepository.class);
getInvokerFor(repository, expectInvocationOf(method)).invokeQueryMethod(method, parameters, Pageable.unpaged(), Sort.unsorted());
}
}
use of org.springframework.data.repository.support.CrudRepositoryInvokerUnitTests.PersonRepository in project spring-data-commons by spring-projects.
the class ReflectionRepositoryInvokerUnitTests method invokesQueryMethod.
// DATACMNS-589
@Test
public void invokesQueryMethod() throws Exception {
MultiValueMap<String, String> parameters = new LinkedMultiValueMap<>();
parameters.add("firstName", "John");
Method method = PersonRepository.class.getMethod("findByFirstName", String.class, Pageable.class);
PersonRepository repository = mock(PersonRepository.class);
getInvokerFor(repository, expectInvocationOf(method)).invokeQueryMethod(method, parameters, Pageable.unpaged(), Sort.unsorted());
}
Aggregations