ProjectServiceImpl implements ProjectService, SmartLifecycle { @Override public List<Project> listProjectsForAgreement() { String query = "SELECT DISTINCT p FROM Project p, ProjectPermission pp " + "WHERE pp.project = p.id " + "AND pp.level = :annotator " + "GROUP BY p.id HAVING count(*) > 1 " + "ORDER BY p.name ASC"; List<Project> projects = entityManager .createQuery(query, Project.class) .setParameter("annotator", PermissionLevel.ANNOTATOR) .getResultList(); return projects; } @Autowired  ProjectServiceImpl(UserDao aUserRepository, 
            ApplicationEventPublisher aApplicationEventPublisher, 
            RepositoryProperties aRepositoryProperties,
            @Lazy @Autowired(required = false) List<ProjectInitializer> aInitializerProxy);  ProjectServiceImpl(UserDao aUserRepository, 
            ApplicationEventPublisher aApplicationEventPublisher, 
            RepositoryProperties aRepositoryProperties,
            List<ProjectInitializer> aInitializerProxy,
            EntityManager aEntityManager); @Override @Transactional void createProject(Project aProject); @Override @Transactional void updateProject(Project aProject); @Override @Transactional(isolation = Isolation.READ_UNCOMMITTED) void recalculateProjectState(Project aProject); @Override @Transactional void createProjectPermission(ProjectPermission aPermission); @Override @Transactional boolean existsProject(String aName); @Override boolean existsProjectPermission(User aUser, Project aProject); @Override @Transactional boolean existsProjectPermissionLevel(User aUser, Project aProject,
            PermissionLevel aLevel); @Override @Transactional boolean existsProjectTimeStamp(Project aProject, String aUsername); @Override boolean existsProjectTimeStamp(Project aProject); @Override File getProjectLogFile(Project aProject); @Override File getGuidelinesFolder(Project aProject); @Override File getMetaInfFolder(Project aProject); @Deprecated @Override @Transactional(noRollbackFor = NoResultException.class) List<Authority> listAuthorities(User aUser); @Override File getGuideline(Project aProject, String aFilename); @Override @Transactional(noRollbackFor = NoResultException.class) List<ProjectPermission> listProjectPermissionLevel(User aUser, Project aProject); @Override @Transactional(noRollbackFor = NoResultException.class) List<PermissionLevel> getProjectPermissionLevels(User aUser, Project aProject); @Override @Transactional(noRollbackFor = NoResultException.class) void setProjectPermissionLevels(User aUser, Project aProject,
            Collection<PermissionLevel> aLevels); @Override List<User> listProjectUsersWithPermissions(Project aProject); @Override List<User> listProjectUsersWithPermissions(Project aProject,
            PermissionLevel aPermissionLevel); @Override @Transactional Project getProject(String aName); @Override Project getProject(long aId); @Override void createGuideline(Project aProject, File aContent, String aFileName); @Override void createGuideline(Project aProject, InputStream aIS, String aFileName); @Override @Transactional(noRollbackFor = NoResultException.class) List<ProjectPermission> getProjectPermissions(Project aProject); @Override @Transactional Date getProjectTimeStamp(Project aProject, String aUsername); @Override Date getProjectTimeStamp(Project aProject); @Override @Transactional(noRollbackFor = NoResultException.class) List<Project> listProjectsWithFinishedAnnos(); @Override List<String> listGuidelines(Project aProject); @Override boolean hasGuidelines(Project aProject); @Override @Transactional List<Project> listProjects(); @Override @Transactional void removeProject(Project aProject); @Override void removeGuideline(Project aProject, String aFileName); @Override @Transactional void removeProjectPermission(ProjectPermission aPermission); @Override void savePropertiesFile(Project aProject, InputStream aIs, String aFileName); @Override List<Project> listAccessibleProjects(User user); @Override List<Project> listManageableProjects(User user); @Override boolean isRunning(); @Override void start(); @Override void stop(); @Override int getPhase(); @Override boolean isAutoStartup(); @Override void stop(Runnable aCallback); @Override List<ProjectType> listProjectTypes(); @Override boolean managesAnyProject(User user); @Override boolean isManager(Project aProject, User aUser); @Override @Deprecated boolean isAdmin(Project aProject, User aUser); @Override boolean isCurator(Project aProject, User aUser); @Override boolean isAnnotator(Project aProject, User aUser); @EventListener void onContextRefreshedEvent(ContextRefreshedEvent aEvent); @Override @Transactional void initializeProject(Project aProject); @Override List<Project> listProjectsForAgreement(); @Override List<Project> listManageableCuratableProjects(User aUser);  }
@Test public void listProjectsForAgreement_ShouldReturnOneProject() { List<Project> foundProjects = sut.listProjectsForAgreement(); assertThat(foundProjects).containsExactly(testProject); }