use of io.crnk.jpa.model.TestEntity in project crnk-framework by crnk-project.
the class JpaListenerTest method test.
@SuppressWarnings("unchecked")
@Test
public void test() throws InstantiationException, IllegalAccessException {
JpaRepositoryFilterBase filter = Mockito.spy(new JpaRepositoryFilterBase());
module.addFilter(filter);
QuerySpec querySpec = new QuerySpec(TestEntity.class);
ResourceList<TestEntity> list = repo.findAll(querySpec);
Assert.assertEquals(5, list.size());
Mockito.verify(filter, Mockito.times(1)).filterQuerySpec(Mockito.eq(repo), Mockito.eq(querySpec));
Mockito.verify(filter, Mockito.times(1)).filterResults(Mockito.eq(repo), Mockito.eq(querySpec), Mockito.eq(list));
Mockito.verify(filter, Mockito.times(1)).filterExecutor(Mockito.eq(repo), Mockito.eq(querySpec), Mockito.any(JpaQueryExecutor.class));
Mockito.verify(filter, Mockito.times(1)).filterTuples(Mockito.eq(repo), Mockito.eq(querySpec), Mockito.anyList());
Mockito.verify(filter, Mockito.times(1)).filterQuery(Mockito.eq(repo), Mockito.eq(querySpec), Mockito.any(JpaQuery.class));
}
Aggregations