2016-04-28 3 views
1

Я пытаюсь использовать метод атрибутов, как описано here, , но он не распознается. Также не признан ключ метода.Атрибуты Spring Rest docs

У меня отсутствует статический импорт?

Мой код:

MvcResult result = mockMvc.perform(post(URL_PREFIX + "/scripts/") 
    .contentType(MediaType.APPLICATION_JSON) 
    .content(asJsonString(script))) 
    .andExpect(status().is(HttpStatus.CREATED.value())) 
    .andExpect(content().contentTypeCompatibleWith(MediaTypes.HAL_JSON)) 
    .andDo(document("create-script-example" 
    , links(
     linkWithRel("self").description("Link self"), 
     linkWithRel("script").description("Link to the created script resource")), 
    responseFields(
     attributes(
      key("title").value("Fields for user creation")), 
     fieldWithPath("_links").description("The available links"), 
     fieldWithPath("name").description("the name of the created script"), 
     fieldWithPath("domain").description("the domain of created the script").optional(), 
     fieldWithPath("script").description("the code in Groovy format of the created script")) 
    , requestFields(
     fieldWithPath("id").description("the id of the script to create, should be null"), 
     fieldWithPath("name").description("the name of the script to create"), 
     fieldWithPath("domain").description("the domain of the script to create"), 
     fieldWithPath("script").description("the code in Groovy format of the script to create") 
))) 
.andReturn(); 

ответ

3

Я нашел ответ: импорт статических org.springframework.restdocs.snippet.Attributes.attributes; import static org.springframework.restdocs.snippet.Attributes.key;

Смежные вопросы