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:
Oliver Gierke
2014-11-26 12:55:46 +01:00
parent a3d1562df4
commit 50deeeb9f0

View File

@@ -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");