### Question:
QuestionReplyExport { public boolean isReplyVisible(Question question, Reply reply, QuestionReplySessionController scc) { return isReplyVisible(question, reply, scc.getUserRole(), scc.getUserId()); } QuestionReplyExport(MultiSilverpeasBundle resource, File file); void exportQuestion(Question question, StringBuilder sb,
      QuestionReplySessionController scc); boolean isReplyVisible(Question question, Reply reply,
      QuestionReplySessionController scc); static boolean isReplyVisible(Question question, Reply reply, SilverpeasRole role,
      String userId);  }### Answer:
@Test public void testIsReplyVisible() { Question question = new Question("10", "questionReply12"); Reply privateReply = new Reply(); privateReply.setPublicReply(0); Reply publicReply = new Reply(); publicReply.setPublicReply(1); QuestionReplySessionController adminScc = mock(QuestionReplySessionController.class); when(adminScc.getUserRole()).thenReturn(SilverpeasRole.admin); QuestionReplySessionController writerScc = mock(QuestionReplySessionController.class); when(writerScc.getUserRole()).thenReturn(SilverpeasRole.writer); QuestionReplySessionController publisherCreatorScc = mock(QuestionReplySessionController.class); when(publisherCreatorScc.getUserRole()).thenReturn(SilverpeasRole.publisher); when(publisherCreatorScc.getUserId()).thenReturn("10"); QuestionReplySessionController publisherScc = mock(QuestionReplySessionController.class); when(publisherScc.getUserRole()).thenReturn(SilverpeasRole.publisher); when(publisherScc.getUserId()).thenReturn("20"); QuestionReplySessionController userScc = mock(QuestionReplySessionController.class); when(userScc.getUserRole()).thenReturn(SilverpeasRole.user); when(userScc.getUserId()).thenReturn("20"); QuestionReplyExport instance = new QuestionReplyExport(null, null); assertThat("Admin should see everything", instance.isReplyVisible(question, privateReply, adminScc), is(true)); assertThat("Admin should see everything", instance.isReplyVisible(question, publicReply, adminScc), is(true)); assertThat("Writer should see everything", instance.isReplyVisible(question, privateReply, writerScc), is(true)); assertThat("Writer should see everything", instance.isReplyVisible(question, publicReply, writerScc), is(true)); assertThat("User should see everything public", instance.isReplyVisible(question, publicReply, userScc), is(true)); assertThat("User should not see everything private", instance.isReplyVisible(question, privateReply, userScc), is(false)); assertThat("Publisher should see everything public", instance.isReplyVisible(question, publicReply, publisherCreatorScc), is(true)); assertThat("Publisher should see everything it has created", instance.isReplyVisible(question, privateReply, publisherCreatorScc), is(true)); assertThat("Publisher should see everything public", instance.isReplyVisible(question, publicReply, publisherScc), is(true)); assertThat("Publisher should not see everything", instance.isReplyVisible(question, privateReply, publisherScc), is(false)); }