DATACMNS-376 - Repositories now inspects user class for factory lookups.
When looking up the RepositoryFactoryInformation for a domain type we now make sure we look up the user type to not accidentally try to do so for a persistence provider generated proxy class for the original type. This prevents us from not finding PersistentEntity instances, Repository- or EntityInformation accidentally.
This commit is contained in:
@@ -17,6 +17,7 @@ package org.springframework.data.repository.support;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.*;
|
||||
import static org.junit.Assert.*;
|
||||
import static org.mockito.Mockito.*;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
@@ -87,6 +88,16 @@ public class RepositoriesIntegrationTests {
|
||||
assertThat(repositories.getCrudInvoker(Product.class), is(instanceOf(ReflectionRepositoryInvoker.class)));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-376
|
||||
*/
|
||||
@Test
|
||||
public void returnsPersistentEntityForProxiedClass() {
|
||||
|
||||
User user = mock(User.class);
|
||||
assertThat(repositories.getPersistentEntity(user.getClass()), is(notNullValue()));
|
||||
}
|
||||
|
||||
static class User {
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user