DATAJPA-632 - Fix SimpleJpaQueryUnit test after cleanups in Spring Data Commons.
We now use a JpaQueryMethod instance rather than a mock as isPageQuery() cannot be mocked anymore as it has been made final. Related issue: DATACMNS-601.
This commit is contained in:
@@ -85,14 +85,10 @@ public class SimpleJpaQueryUnitTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
public void prefersDeclaredCountQueryOverCreatingOne() throws Exception {
|
||||
|
||||
method = mock(JpaQueryMethod.class);
|
||||
when(method.getCountQuery()).thenReturn("foo");
|
||||
when(method.getParameters()).thenReturn(
|
||||
new JpaParameters(SimpleJpaQueryUnitTests.class.getMethod("prefersDeclaredCountQueryOverCreatingOne")));
|
||||
when(method.getEntityInformation()).thenReturn((JpaEntityMetadata) new DefaultJpaEntityMetadata<User>(User.class));
|
||||
method = new JpaQueryMethod(SimpleJpaQueryUnitTests.class.getMethod("prefersDeclaredCountQueryOverCreatingOne"),
|
||||
metadata, extractor); // mock(JpaQueryMethod.class);
|
||||
when(em.createQuery("foo", Long.class)).thenReturn(query);
|
||||
|
||||
SimpleJpaQuery jpaQuery = new SimpleJpaQuery(method, em, "select u from User u");
|
||||
|
||||
Reference in New Issue
Block a user