@Test
public void testAddQuestionForFailureWhenQuestionTitleNotProvided() throws Exception {

    QuestionForm questionForm = new QuestionForm();
    questionForm.setValidator(validator);
    when(requestContext.getMessageContext()).thenReturn(messageContext);
    when(messageContext.hasErrorMessages()).thenReturn(true);
    String result = questionController.addQuestion(questionForm, requestContext, true);
    Assert.assertThat(questionForm.getQuestions().size(), is(0));
    Assert.assertThat(result, is(notNullValue()));
    Assert.assertThat(result, is("failure"));
    Mockito.verify(requestContext).getMessageContext();
    Mockito.verify(messageContext).addMessage(argThat(new MessageMatcher("NotNull.QuestionForm.currentQuestion.text")));
}