3

You can test your "normal" Spring MVC Controllers using the MockMvc class like so:

    mockMvc
        .perform(get("/my/fine/path"))
        .andExpect(status().isOk());

From the Spring Reference on Handler Mappings:

Since there is really no such thing as a URL within a Portlet, we must use other mechanisms to control mappings. The two most common are the portlet mode and a request parameter, but anything available to the portlet request can be used in a custom handler mapping.

Is MockMvc only for "normal" Controllers or is there a way of using it when testing Portlet Controllers?

Jörgen Lundberg
  • 1,799
  • 3
  • 22
  • 31
  • I will be interested to see if you get any answers to this. In the meantime you may find this of interest regarding portlet controller testing: http://jamesfarrell129.wordpress.com/2011/04/20/integration-testing-for-spring-portlet-mvc/ – Mark Chorley Jun 12 '13 at 17:41

1 Answers1

0

Checkout spring-test-portlet-mvc (https://github.com/markusf/spring-test-portlet-mvc), which exposes the features of MockMvc to the Portal context!

markusf
  • 303
  • 1
  • 3
  • 5