Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spring MVC Test: ViewResultMatchers does not respect ViewResolvers [SPR-10457] #15090

spring-projects-issues opened this issue Apr 11, 2013 · 1 comment


Copy link

@spring-projects-issues spring-projects-issues commented Apr 11, 2013

Deejay opened SPR-10457 and commented

When using the new Spring MVC Test functionality, it is not possible to test that ViewResolvers are working correctly, as the original view name is used to assertion rather than the resolved view name.

This became apparent in my project when using Spring Mobile's LiteDeviceDelegatingViewResolver to prepend view names with "tablet/" in the presence of a User-Agent header containing the string "android".

Attached is a test class and config. You'll need to add your own view.

Affects: 3.2.2


Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented May 10, 2013

Rossen Stoyanchev commented

On a second thought, I think this working as it should. The view name you're testing is the one selected by the controller (i.e. "index"). The resolved view name ("tablet/index") is a matter internal to the LiteDeviceDelegatingViewResolver and shouldn't be a concern for application tests.

Instead what you need to test is the outcome. Since you're using Freemarker, the freemarker template will be written to the body of the response, so test that and makes it has the content from "tablet/index.ftl".


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants