Ejemplo n.º 1
0
  @Test
  public void findById_QuestionnaireFound_ShouldReturnFound() throws Exception {
    Questionnaire questionnaire =
        new QuestionnaireBuilder(1L).description("MyDescription").title("MyTitle").build();

    when(questionnaireRepositoryMock.findOne(1L)).thenReturn(questionnaire);

    mockMvc
        .perform(get("/questionnaires/{id}", 1L).header("Accept", "application/json"))
        // .andDo(print())
        .andExpect(status().isOk())
        .andExpect(jsonPath("$.id", is(1)))
        .andExpect(jsonPath("$.title", is("MyTitle")))
        .andExpect(jsonPath("$.description", is("MyDescription")));
  }