Search in sources :

Example 1 with QuerydslRepositoryFilterBase

use of io.crnk.jpa.query.querydsl.QuerydslRepositoryFilterBase in project crnk-framework by crnk-project.

the class QuerydslRepositoryFilterTest method translationInterceptor.

@SuppressWarnings("unchecked")
@Test
public void translationInterceptor() {
    JpaEntityRepository<TestEntity, Long> repo = new JpaEntityRepository<>(module, JpaRepositoryConfig.create(TestEntity.class));
    QuerydslRepositoryFilterBase filter = Mockito.spy(new QuerydslRepositoryFilterBase());
    module.addFilter(filter);
    QuerySpec querySpec = new QuerySpec(TestEntity.class);
    repo.findAll(querySpec);
    Mockito.verify(filter, Mockito.times(1)).filterQueryTranslation(Mockito.eq(repo), Mockito.eq(querySpec), Mockito.any(QuerydslTranslationContext.class));
}
Also used : TestEntity(io.crnk.jpa.model.TestEntity) QuerydslRepositoryFilterBase(io.crnk.jpa.query.querydsl.QuerydslRepositoryFilterBase) QuerydslTranslationContext(io.crnk.jpa.query.querydsl.QuerydslTranslationContext) QuerySpec(io.crnk.core.queryspec.QuerySpec) JpaEntityRepository(io.crnk.jpa.JpaEntityRepository) Test(org.junit.Test) AbstractJpaTest(io.crnk.jpa.query.AbstractJpaTest)

Aggregations

QuerySpec (io.crnk.core.queryspec.QuerySpec)1 JpaEntityRepository (io.crnk.jpa.JpaEntityRepository)1 TestEntity (io.crnk.jpa.model.TestEntity)1 AbstractJpaTest (io.crnk.jpa.query.AbstractJpaTest)1 QuerydslRepositoryFilterBase (io.crnk.jpa.query.querydsl.QuerydslRepositoryFilterBase)1 QuerydslTranslationContext (io.crnk.jpa.query.querydsl.QuerydslTranslationContext)1 Test (org.junit.Test)1