### Question:
PermissionManager { public void setPublic(String spec) { spec = StringUtils.trimToNull(spec); if (spec == null) { throw new TabInvalidValueException("Invalid syntax for the study list: '" + spec + "'"); } String accs[] = spec.split("\\,"); if (accs == null || accs.length == 0) { throw new TabInvalidValueException("Invalid syntax for the study list: '" + spec + "'"); } setPublic(accs); } 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 testVisibility() { SimplePipelineModel pip = new SimplePipelineModel(); pip.study.setAcc("s1"); SimplePipelineModel pip1 = new SimplePipelineModel(); pip1.study.setAcc("s2"); pip1.assayMaterial1.setAcc("s2.as1"); pip1.nas1.setAcc("s2.nas1"); pip1.nsrc1.setAcc("s2.nsrc1"); pip1.src1.setAcc("s2.src1"); pip1.nsrc2.setAcc("s2.nsrc2"); pip1.src2.setAcc("s2.src2"); pip1.p1.setAcc("s2.papp1"); pip1.p2.setAcc("s2.papp2"); pip1.nar1.setAcc("s2.nar1"); pip1.nar2.setAcc("s2.nar2"); pip1.dt1.setAcc("s2.dt1"); pip1.dt2.setAcc("s2.dt2"); Timestamp ts = new Timestamp(System.currentTimeMillis()); StudyPersister studyPersister = new StudyPersister(daoFactory, ts); AssayMaterialPersister assayMaterialPersister = new AssayMaterialPersister(daoFactory, ts); studyPersister.persist(pip.study); assayMaterialPersister.persist(pip.assayMaterial1); studyPersister.persist(pip1.study); assayMaterialPersister.persist(pip1.assayMaterial1); commitTansaction(); session.flush(); PermissionManager permMgr = new PermissionManager(entityManager); permMgr.setPublic("s1,s2"); commitTansaction(); session.flush(); assertEquals("Visibility set failed!", VisibilityStatus.PUBLIC, pip.study.getStatus()); assertEquals("Visibility set failed!", VisibilityStatus.PUBLIC, pip1.study.getStatus()); }