JpaSpecProvider { public Specification<T> jpaSpecFor(Class<? extends T> domainType) { Specification<T> aclJpaSpec = defaultJpaSpec; AclStrategy strategy = strategyProvider.strategyFor(domainType); if (strategy == null) { logger.debug("No strategy found for '{}' in strategy provider", domainType.getSimpleName()); } else { Specification<T> aclJpaSpecification = strategy.handlerFor(jpaSpecFeature); if (aclJpaSpecification == null) { logger.debug( "No ACL JPA specification found in strategy {} > fall back on default ACL JPA specification", strategy); } else { aclJpaSpec = aclJpaSpecification; } } logger.debug("Using ACL JPA specification for '{}': {}", domainType.getSimpleName(), aclJpaSpec); return aclJpaSpec; } JpaSpecProvider(AclStrategyProvider strategyProvider, JpaSpecFeature<T> jpaSpecFeature,
      Specification<T> defaultJpaSpec); Specification<T> jpaSpecFor(Class<? extends T> domainType);  }
@Test public void should_use_default_handler_when_none_defined() { assertThat(jpaSpecProvider.jpaSpecFor(WithoutHandlerObject.class)).isSameAs(defaultAclSpecification); }
@Test public void should_use_default_handler_when_unknown_defined() { assertThat(jpaSpecProvider.jpaSpecFor(UnknownStrategyObject.class)).isSameAs(defaultAclSpecification); }
@Test public void should_use_default_handler_when_no_strategy_defined() { assertThat(jpaSpecProvider.jpaSpecFor(NoStrategyObject.class)).isSameAs(defaultAclSpecification); }