use of org.springframework.data.repository.core.RepositoryMetadata in project spring-data-commons by spring-projects.
the class DefaultRepositoryMetadataUnitTests method detectsParameterizedEntitiesCorrectly.
@Test
public void detectsParameterizedEntitiesCorrectly() {
RepositoryMetadata metadata = new DefaultRepositoryMetadata(GenericEntityRepository.class);
assertThat(metadata.getDomainType()).isEqualTo(GenericEntity.class);
}
use of org.springframework.data.repository.core.RepositoryMetadata in project spring-data-commons by spring-projects.
the class DefaultRepositoryMetadataUnitTests method discoversDomainTypeOnNestedReturnTypeWrapper.
// DATACMNS-483
@Test
public void discoversDomainTypeOnNestedReturnTypeWrapper() throws Exception {
RepositoryMetadata metadata = new DefaultRepositoryMetadata(OptionalRepository.class);
Method method = OptionalRepository.class.getMethod("findByLastname", String.class);
assertThat(metadata.getReturnedDomainClass(method)).isEqualTo(User.class);
}
use of org.springframework.data.repository.core.RepositoryMetadata in project spring-data-commons by spring-projects.
the class ReactiveRepositoryInformationUnitTests method extractTargetMethodFromRepository.
private Method extractTargetMethodFromRepository(Class<?> repositoryType, String methodName, Class<?>... args) throws NoSuchMethodException {
RepositoryMetadata metadata = new DefaultRepositoryMetadata(repositoryType);
RepositoryComposition composition = RepositoryComposition.of(RepositoryFragment.structural(BASE_CLASS)).withMethodLookup(MethodLookups.forReactiveTypes(metadata));
return composition.findMethod(repositoryType.getMethod(methodName, args)).get();
}
use of org.springframework.data.repository.core.RepositoryMetadata in project spring-data-commons by spring-projects.
the class RepositoryConfigurationExtensionSupportUnitTests method doesNotConsiderRepositoryForPlainTypeStrictMatch.
// DATACMNS-526
@Test
public void doesNotConsiderRepositoryForPlainTypeStrictMatch() {
RepositoryMetadata metadata = AbstractRepositoryMetadata.getMetadata(PlainTypeRepository.class);
assertThat(extension.isStrictRepositoryCandidate(metadata)).isFalse();
}
use of org.springframework.data.repository.core.RepositoryMetadata in project spring-data-commons by spring-projects.
the class RepositoryConfigurationExtensionSupportUnitTests method considersRepositoryWithAnnotatedTypeStrictMatch.
// DATACMNS-526
@Test
public void considersRepositoryWithAnnotatedTypeStrictMatch() {
RepositoryMetadata metadata = AbstractRepositoryMetadata.getMetadata(AnnotatedTypeRepository.class);
assertThat(extension.isStrictRepositoryCandidate(metadata)).isTrue();
}
Aggregations