### Question:
AbstractCrudService extends AbstractDaoService<E, D> { @PostFilter("hasRole(@configHolder.getSuperAdminRoleName()) or hasPermission(filterObject, 'READ')") @Transactional(readOnly = true) public List<E> findAll() { return dao.findAll(); } protected  AbstractCrudService(Class<E> entityClass); @PreAuthorize("hasRole(@configHolder.getSuperAdminRoleName())" + " or (#e.id == null and hasPermission(#e, 'CREATE'))" + " or (#e.id != null and hasPermission(#e, 'UPDATE'))") void saveOrUpdate(E e); @PreAuthorize("hasRole(@configHolder.getSuperAdminRoleName()) or hasPermission(#entity, 'UPDATE')") E updatePartialWithJsonNode(E entity, JsonNode jsonObject, ObjectMapper objectMapper); @PostAuthorize("hasRole(@configHolder.getSuperAdminRoleName()) or hasPermission(returnObject, 'READ')") @Transactional(readOnly = true) E findById(Integer id); @PostAuthorize("hasRole(@configHolder.getSuperAdminRoleName()) or hasPermission(returnObject, 'READ')") @Transactional(readOnly = true) E loadById(int id); @PostFilter("hasRole(@configHolder.getSuperAdminRoleName()) or hasPermission(filterObject, 'READ')") @Transactional(readOnly = true) List<E> findAll(); @PostFilter("hasRole(@configHolder.getSuperAdminRoleName()) or hasPermission(filterObject, 'READ')") List<E> findAllRestricted(MultiValueMap<String, String> restrictToRequest); @PostFilter("hasRole(@configHolder.getSuperAdminRoleName()) or hasPermission(filterObject, 'READ')") @Transactional(readOnly = true) List<E> findBySimpleFilter(MultiValueMap<String, String> requestedFilter); @PostFilter("hasRole(@configHolder.getSuperAdminRoleName()) or hasPermission(filterObject, 'READ')") @Transactional(readOnly = true) List<E> findAllWhereFieldEquals(String fieldName, Object fieldValue); @PostFilter("hasRole(@configHolder.getSuperAdminRoleName()) or hasPermission(filterObject, 'READ')") @Transactional(readOnly = true) List<E> findAllWithCollectionContaining(String fieldName, PersistentObject subElement); @PreAuthorize("hasRole(@configHolder.getSuperAdminRoleName()) or hasPermission(#e, 'DELETE')") void delete(E e);  }### Answer:
@SuppressWarnings({"unchecked"}) @Test public void findAll_shouldFindAll() throws NoSuchFieldException, IllegalAccessException, InstantiationException, InvocationTargetException, NoSuchMethodException { final Integer id1 = 17; final Integer id2 = 42; List<E> persistedObjectList = new ArrayList<E>(); E obj1 = implToTest; E obj2 = (E) BeanUtils.cloneBean(obj1); IdHelper.setIdOnPersistentObject(obj1, id1); IdHelper.setIdOnPersistentObject(obj2, id2); persistedObjectList.add((E) obj1); persistedObjectList.add((E) obj2); doReturn(persistedObjectList).when(dao).findAll(); List<E> resultList = crudService.findAll(); assertNotNull(resultList); assertEquals(2, resultList.size()); Matcher<E> m1 = hasProperty("id", is(id1)); Matcher<E> m2 = hasProperty("id", is(id2)); assertThat(resultList, IsIterableContainingInAnyOrder.<E>containsInAnyOrder(m1, m2)); verify(dao, times(1)).findAll(); }