/** 登入的使用者沒有AccessSprintBacklog的權限 */
  public void testShowInformationAction_4() {
    int sprintCount = 1;
    CreateSprint createSprint = new CreateSprint(sprintCount, mCP);
    createSprint.exe();

    int accountCount = 1;
    CreateAccount createAccount = new CreateAccount(accountCount);
    createAccount.exe();
    AddUserToRole addUserToRole = new AddUserToRole(mCP, createAccount);
    addUserToRole.exe_Guest();

    // ================ set request info ========================
    String expectedSprintID = "1";
    String projectName = mProject.getName();
    request.setHeader("Referer", "?PID=" + projectName);
    addRequestParameter("sprintID", expectedSprintID);

    // ================ set session info ========================
    AccountObject account = createAccount.getAccountList().get(0);
    UserSession newUser = new UserSession(new AccountMapper().getAccount(account.getUsername()));
    request.getSession().setAttribute("UserSession", newUser);

    // ================ 執行 action ======================
    actionPerform();

    // ================ assert ========================
    verifyNoActionErrors();
    verifyNoActionMessages();
    /*
     * in struts-config.xml
     * <forward name="GuestOnly" path="Guest.Summary" />
     * 因此根據Guest.Summary必須到tiles-defs.xml找到要轉發的頁面
     * in tiles-defs.xml
     * <definition name="Guest.Summary" extends="base.layout">
     * <definition name="base.layout" path="/Layout/Layout.jsp">
     */
    verifyForward("GuestOnly");
    verifyForwardPath("/Layout/Layout.jsp");
  }
  /**
   * 專案擁有一個Sprint且專案擁有一位成員
   *
   * @throws Exception
   */
  public void testShowInformationAction_3() throws Exception {
    int sprintCount = 1;
    CreateSprint createSprint = new CreateSprint(sprintCount, mCP);
    createSprint.exe();

    int storyCount = 1;
    int expectStoryEstimation = 5;
    AddStoryToSprint addStoryToSprint =
        new AddStoryToSprint(
            storyCount,
            expectStoryEstimation,
            createSprint,
            mCP,
            CreateProductBacklog.COLUMN_TYPE_EST);
    addStoryToSprint.exe();

    int accountCount = 1;
    CreateAccount createAccount = new CreateAccount(accountCount);
    createAccount.exe();
    AddUserToRole addUserToRole = new AddUserToRole(mCP, createAccount);
    addUserToRole.exe_ST();

    // ================ set request info ========================
    String expectedSprintID = "1";
    String projectName = mProject.getName();
    request.setHeader("Referer", "?PID=" + projectName);
    addRequestParameter("sprintID", expectedSprintID);

    // ================ set session info ========================
    request.getSession().setAttribute("UserSession", mConfig.getUserSession());

    // ================ 執行 action ======================
    actionPerform();

    // ================ assert ========================
    verifyNoActionErrors();
    verifyNoActionMessages();
    /*
     * in struts-config.xml
     * <forward name="success" path="sprintInformation.show"/>
     * 因此根據sprintInformation.show必須到tiles-defs.xml找到要轉發的頁面
     * in tiles-defs.xml
     * <definition name="sprintInformation.show" path="/Pages/ShowSprintInformation.jsp"></definition>
     */
    verifyForward("success");
    verifyForwardPath("/Pages/ShowSprintInformation.jsp");

    String actualSprintID = String.valueOf(request.getAttribute("SprintID"));
    String actualStoryPoint = String.valueOf(request.getAttribute("StoryPoint"));
    ISprintPlanDesc actualSprintPlan = (ISprintPlanDesc) request.getAttribute("SprintPlan");
    String actualSprintPeriod = String.valueOf(request.getAttribute("SprintPeriod"));
    @SuppressWarnings("unchecked")
    ArrayList<StoryObject> actualStories = (ArrayList<StoryObject>) request.getAttribute("Stories");
    @SuppressWarnings("unchecked")
    ArrayList<String> actualActors = (ArrayList<String>) request.getAttribute("Actors");

    TestTool testTool = new TestTool();
    Date today = createSprint.mToday;
    Date startDate = testTool.getSprintStartDate(CreateSprint.SPRINT_INTERVAL, today);
    Date endDate = testTool.getSprintEndDate(CreateSprint.SPRINT_INTERVAL, today);
    String expectedSprintPeriod =
        testTool.transformDate(startDate) + " to " + testTool.transformDate(endDate);

    /**
     * 1. verify sprint ID 2. verify story information 3. verify sprint plan information 5. verify
     * Sprint週期 6. verify 參與此專案的人
     */
    //	verify sprint ID
    assertEquals(expectedSprintID, actualSprintID);

    //	verify story information
    assertNotNull(actualStories);
    assertEquals("TEST_STORY_1", actualStories.get(0).getName());
    assertEquals("5.0", actualStoryPoint);

    //	verify sprint plan information
    assertNotNull(actualSprintPlan);
    assertEquals(createSprint.TEST_SPRINT_GOAL + expectedSprintID, actualSprintPlan.getGoal());

    //	verify Sprint週期
    assertEquals(expectedSprintPeriod, actualSprintPeriod);

    //	verify 參與此專案的人
    String expectAccountID = createAccount.getAccount_ID(1);
    boolean isExistedAccount = false;
    for (String accountID : actualActors) {
      if (accountID.equals(expectAccountID)) {
        isExistedAccount = true;
        break;
      }
    }
    assertTrue(isExistedAccount);
  }