@SuppressWarnings({"ThrowableInstanceNeverThrown"})

@Test
public void testGetQuestionGroupWhenNotPresentInDb() throws SystemException {
    int questionGroupId = 1;
    when(questionnaireServiceFacade.getQuestionGroupDetail(questionGroupId)).thenThrow(new SystemException(QuestionnaireConstants.QUESTION_GROUP_NOT_FOUND));
    when(httpServletRequest.getParameter("questionGroupId")).thenReturn("1");
    String view = questionGroupController.getQuestionGroup(model, httpServletRequest);
    assertThat(view, Is.is("viewQuestionGroupDetail"));
    verify(questionnaireServiceFacade).getQuestionGroupDetail(questionGroupId);
    verify(httpServletRequest, times(1)).getParameter("questionGroupId");
    verify(model).addAttribute("error_message_code", QuestionnaireConstants.QUESTION_GROUP_NOT_FOUND);
}