@SuppressWarnings({"ThrowableInstanceNeverThrown"})

@Test
public void testCreateQuestionFailure() throws Exception {
    QuestionForm questionForm = getQuestionForm(TITLE, "numeric");
    when(requestContext.getMessageContext()).thenReturn(messageContext);
    Mockito.doThrow(new SystemException("db.write.failure")).when(questionnaireServiceFacade).createQuestions(Matchers.<List<QuestionDetail>>anyObject());
    String result = questionController.createQuestions(questionForm, requestContext);
    Assert.assertThat(result, is("failure"));
    Mockito.verify(questionnaireServiceFacade).createQuestions(Matchers.<List<QuestionDetail>>anyObject());
    Mockito.verify(requestContext).getMessageContext();
    Mockito.verify(messageContext).addMessage(argThat(new MessageMatcher("db.write.failure")));
}