0

I have configured as follows my rest docs with Junit4 ,with spring boot 1.4

@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = Application.class)
@WebAppConfiguration
@ActiveProfiles(SPRING_PROFILE_ACTIVE_TEST)
public class CustomerDetailsControllerWACTest {

    @Autowired
    private WebApplicationContext  wac;


    @Rule
    public final JUnitRestDocumentation documentation =
            new JUnitRestDocumentation("build/generated-snippets");

    private RestDocumentationResultHandler document;

    MockMvc mockMvc;


    @Before
    public void setUp() throws Exception
    {
        this.document = document("{method-name}", preprocessRequest(prettyPrint()), preprocessResponse(prettyPrint()));


        this.mockMvc = MockMvcBuilders.webAppContextSetup(wac).
                apply(documentationConfiguration(this.documentation))
                .alwaysDo(this.document)
                .build();
    }

But the error is The method documentationConfiguration(RestDocumentation) in the type MockMvcRestDocumentation is not applicable for the arguments (JUnitRestDocumentation)

The documentation also has same configuration as mentioned here.But still it is showing above error.

RestDocs Dependancies(version): spring-restdocs-core-1.1.1 and spring-restdocs-mockmvc-1.0.1

MasterCode
  • 975
  • 5
  • 21
  • 44
  • Can you add what exact version of spring-restdoc are you using? I use 1.1.2 and the exact same code does not show error. I currently have a problem that it does not output the snippet but it compiles and runs. – Ondrej Burkert Sep 07 '16 at 09:36
  • spring-restdocs-core-1.1.1 and spring-restdocs-mockmvc-1.0.1 – MasterCode Sep 07 '16 at 09:42

1 Answers1

2

You have incompatible version mismatch. You should use the same versions of core and mockmvc.

The JUnitRestDocumentation from spring-restdocs-core 1.1.1 cannot be applied to MockMvcRestDocumentation.documentationConfiguration(RestDocumentation) since that method in version 1.0.1 only accepts RestDocumentation. The overloaded method accepting the interface RestDocumentationContextProvider was added in 1.1.

Ondrej Burkert
  • 6,617
  • 2
  • 32
  • 27