@Test
public void shouldGetQuestionGroupResponses() throws PageExpiredException {

    when(request.getAttribute(Constants.CURRENTFLOWKEY)).thenReturn(FLOW_KEY);
    when(request.getSession()).thenReturn(session);
    when(session.getAttribute(Constants.FLOWMANAGER)).thenReturn(flowManager);
    List<QuestionGroupDetail> questionGroupDetails = asList(getQuestionGroupDetail(1, "QG1", true), getQuestionGroupDetail(2, "QG2", true), getQuestionGroupDetail(3, "QG3", true));
    when(flowManager.getFromFlow(FLOW_KEY, ProductDefinitionConstants.SELECTEDQGLIST)).thenReturn(questionGroupDetails);
    Set<QuestionGroupReference> questionGroupReferences = loanPrdAction.getQuestionGroups(request);
    assertThat(questionGroupReferences, is(notNullValue()));
    assertThat(questionGroupReferences.size(), is(3));
    QuestionGroupReference[] qgReferences = questionGroupReferences.toArray(new QuestionGroupReference[questionGroupReferences.size()]);
    assertThat(qgReferences[0].getQuestionGroupId(), is(1));
    assertThat(qgReferences[1].getQuestionGroupId(), is(2));
    assertThat(qgReferences[2].getQuestionGroupId(), is(3));
    verify(request, times(1)).getAttribute(Constants.CURRENTFLOWKEY);
    verify(request, times(1)).getSession();
    verify(session, times(1)).getAttribute(Constants.FLOWMANAGER);
    verify(flowManager, times(1)).getFromFlow(FLOW_KEY, ProductDefinitionConstants.SELECTEDQGLIST);
}