Julie C
Julie C

Reputation: 1

Spring Restdocs source gradle build fails during test

I have downloaded a copy of the 1.1.0-RELEASE tagged source code for Spring RESTdocs, but "gradlew build" is failing during the test phase. 273 of 502 tests are failing with variations on this error: org.springframework.restdocs.request.RequestPartsSnippetTests > requestPartsWithOptionalColumn[Markdown] FAILED java.lang.AssertionError: Expected: is adoc snippetPart | Optional | Description ---- | -------- | ----------- a | true | one b | false | two but: was:Part | Optional | Description ---- | -------- | ----------- a | true | one b | false | two

The problem looks to be that the string "adoc snippet" is prefixed to the start of the expected output. I don't think that's right, although I can see in the AbstractContentSnippetMatcher.describeTo() why it's happening and it doesn't look very conditional so maybe it's the test's actual result that's wrong?

I have made no changes to the source code* but I don't see other people reporting this problem, so I'm mystified. I'm entirely new to gradle. Is there some kind of config I need to set up to make the tests pass? Should I be using a different target?

(OK... 1 teensy change: I removed the new-line-at-end-of-file check from the checkStyle - I'm downloading from Github onto a Windows PC.)

Upvotes: 0

Views: 114

Answers (1)

Andy Wilkinson
Andy Wilkinson

Reputation: 116051

The problem is that the files in the zip have Unix-style line endings but, when run on Windows, Checkstyle and the tests expect Windows-style line endings.

Typically a Windows Git client will take care of this for you by converting the line endings when you check out the code. For example, the default configuration of Git for Windows is to check code out with Windows-style line endings but commit changes with Windows-style line endings.

You may be able to find a Windows utility that will batch-convert the line endings from LF to CRLF. Failing that, it's probably easiest to install a Git client (such as Git for Windows that I linked to above), ensure it's configure to perform line ending conversion, and then:

> git clone https://github.com/spring-projects/spring-restdocs
> cd spring-restdocs
> gradlew build

Upvotes: 0

Related Questions