Questions tagged [spring-mvc-test]
241 questions
1
vote
1 answer
SpringMVC url path pattern replacement
I have a url path pattern in SpringMVC which looks like:
/person/{personId}/address/{addressId}
and I have personId = 2 and addressId = 3
Is there an easy way for me to generate
/person/2/address/3
using a utility method within SpringMvc?

Mak
- 205
- 1
- 4
- 8
1
vote
1 answer
How to ignore attributes while serializing a class by ObjectMapper
I have a class with lots of attributes which are required for server side logic, but a few of those are required for UI. Now when I am creating a json from the class, all the attributes are written to json. I want to ignore some values only when it…

Arpan Das
- 1,015
- 3
- 24
- 57
1
vote
0 answers
Unable to autowire webApplicationContext Spring MVC Test
I have a Rest API Created with Spring Framework 3.2.4. I am trying to write test cases in the WebApplicationContext. I see from the server log that the xml configuration files are loaded but it fails while executing the TestContextManager.
ROR…

Sumit
- 71
- 1
- 5
1
vote
1 answer
Issue with a Spring integration test involving an entity with lazy collections
I am experimenting with the new Spring Security Test framework. I have a test that involves returning a JPA entity with lazy collections.
The following test ends up in error because one of the lazy…

balteo
- 23,602
- 63
- 219
- 412
1
vote
0 answers
Issues integration testing a Spring MVC controller method that calls an async Spring service method
I have the following Spring MVC controller method:
@RequestMapping(value = "/sendPasswordReset", method = RequestMethod.POST, produces = "text/html")
public String sendPasswordResetInformation(@ModelAttribute @Validated({…

balteo
- 23,602
- 63
- 219
- 412
1
vote
1 answer
Spring MockMVC for a programmatically created WebApplicationContext
I want to write integration tests using springs MockMVC tools:
MockMvcBuilders.webAppContextSetup(...).build();
Reading the available documentation…

Jan
- 2,803
- 6
- 36
- 57
1
vote
1 answer
How to junit return type of a method in spring mvc controller
I am doing junit on my Spring MVC controller -
@RequestMapping(value = "index", method = RequestMethod.GET)
public HashMap handleRequest() {
HashMap model = new HashMap();
String name =…

AKIWEB
- 19,008
- 67
- 180
- 294
1
vote
1 answer
Programmatically starting server in one thread and running test in other thread using maven test command
I have written cucumber/ selenium test cases for my spring mvc project.
My intention is, when I run mvn test from console, I am starting jetty server with spring(mvc dispatcher) beans loaded in one seperate thread and while normal flow consist of…

hariharan kumar
- 439
- 4
- 8
1
vote
1 answer
How to avoid NullPointerException in test used MockMvc?
I have controller:
@Controller
public class EventMenuController{
@RequestMapping(value = "/updateEvent", method = RequestMethod.POST)
public String updateEvent(Model model,
@Valid @ModelAttribute("existedEvent") Event event,
…
user2740224
1
vote
1 answer
@PreAuthorize Security role annotation
I am trying to understand some Spring security code. I am new to Spring Security as well and I guess I am missing here something basic.
I have that annotation on one of the…

rayman
- 20,786
- 45
- 148
- 246
1
vote
1 answer
StandAlone Spring MVC Test framework
I am having difficulties installing the the spring mvc test framework (Standalone) for applications running version of Spring older than 3.2.
The standalone project available on https://github.com/SpringSource/spring-test-mvc exists only in source…

bahaa
- 65
- 7
1
vote
1 answer
Spring MVC Test In Fitnesse
I have a probleme with Fitnesse Integration with Spring MVC .
My use case to test is the authentication :
I have a generic Fixture that load spring Context :
public abstract class GenericSpringFixture extends GenericBelFixture {
protected static…

Nabil
- 1,771
- 4
- 21
- 33
1
vote
1 answer
MVC and Spring MVC Unit Testing
Can i Unit test MVC framework using Spring MVC Unit testing.. if it is possible, what setup do i need to do? I want to do only annotation testing. If it's possible. Sorry for a noob question, I'm really having a hard time figuring this out.

newbie
- 527
- 2
- 8
- 13
0
votes
0 answers
what is the s Spring 6.0.11 module compatible not working on tomcat 10
I have migrated my Spring 4.2.4 version to Spring 6.0.11 version. I am trying to execute it on tomcat 10.But i am getting the follow exception.
java.lang.ClassCastException: class org.springframework.web.servlet.DispatcherServlet cannot be cast to…
0
votes
0 answers
MVC, MockMvc, ModelAttribute issue upgrading to Spring 6 / SB3
Having upgraded an existing SB app from Java 11, Spring 5, SB 2 to Java 17, Spring 6, SB 3 i have an issue i simply cant figure out with the tests. We have a controller which contains a bunch of @ModelAttrbite annotations such as…

martin samm
- 127
- 2
- 7