### Question:
PermissionManager { @SuppressWarnings("unchecked") public List<Person> getUsers() { return daoFactory.getEntityManager().createQuery( "SELECT distinct p FROM Person p ORDER BY p.userName" ) .getResultList(); } PermissionManager(EntityManager entityManager); static Options createUserDefOptions(); @SuppressWarnings("static-access") static Options createUserDefOptions(Options baseOptions); @SuppressWarnings("static-access") static Options createPermModOptions(Options baseOptions); static Options createPermModOptions(); Person createNewUserFromOptions(String login, CommandLine cmdl); void validateUser(Person user); long addUser(Person user); void updateUser(Person user); void deleteUser(String login); void setStudyOwners(CommandLine cmdl); void setStudyOwners(String spec); void setStudyOwners(String studyAcc, String operation, String... logins); void setStatus(CommandLine cmdl, VisibilityStatus status); void setVisibility(CommandLine cmdl); void setPrivate(String spec); void setPrivate(String... studyAccs); void setStatus(VisibilityStatus status, String... studyAccs); void setPublic(String spec); void setPublic(String... studyAccs); @SuppressWarnings("unchecked") List<Study> getStudies(); @SuppressWarnings("unchecked") List<Person> getUsers(); Person getUserByLogin(String login); Study getStudyByAcc(String acc); static String formatUser(Person user); static String formatStudy(Study study); final static String[] VALID_DATE_FORMATS; }### Answer:
@Test public void testGetUsers() { Person user = createTestUser(); session.clear(); user.setId(null); user.setUserName("zakmck1"); createTestUser(user); session.clear(); user.setId(null); user.setUserName("zakmck2"); createTestUser(user); session.clear(); PermissionManager permMgr = new PermissionManager(entityManager); List<Person> prs = permMgr.getUsers(); assertNotNull("getUsers() failed!", prs); for (Person p : prs) { out.println(p); } assertEquals("getUsers() failed!", 3, prs.size()); user.setId(null); user.setUserName("zakmck"); assertEquals("getUsers() failed!", user, prs.get(0)); user.setUserName("zakmck1"); assertEquals("getUsers() failed!", user, prs.get(1)); user.setUserName("zakmck2"); assertEquals("getUsers() failed!", user, prs.get(2)); }