You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I should be able to use GrailsWebMockUtil.bindMockWebRequest() in a test without explicitly adding org.springframework:spring-test to the testCompileClasspath.
This is because org.springframework:spring-test is a compileOnly dependency on grails-web-common so it is not available for consumers, which is correct as we don't want a dependency on org.springframework:spring-test in consumers production dependencies.
This is what the Gradle java-test-fixtures plugin solves. It allows you to separate testFixtures from ordinary classes so you can consume them without getting them in the production classpaths.
Another alternative is to extract GrailsWebMockUtil to a separate project.
Steps To Reproduce
No response
Environment Information
No response
Example Application
No response
Version
The text was updated successfully, but these errors were encountered:
Expected Behavior
I should be able to use
GrailsWebMockUtil.bindMockWebRequest()
in a test without explicitly addingorg.springframework:spring-test
to thetestCompileClasspath
.Actual Behaviour
java.lang.NoClassDefFoundError: org.springframework.mock.web.MockHttpServletRequest
This is because
org.springframework:spring-test
is acompileOnly
dependency ongrails-web-common
so it is not available for consumers, which is correct as we don't want a dependency onorg.springframework:spring-test
in consumers production dependencies.This is what the Gradle
java-test-fixtures
plugin solves. It allows you to separate testFixtures from ordinary classes so you can consume them without getting them in the production classpaths.Another alternative is to extract
GrailsWebMockUtil
to a separate project.Steps To Reproduce
No response
Environment Information
No response
Example Application
No response
Version
The text was updated successfully, but these errors were encountered: