Questions tagged [mockmvc]

MockMVC is the key part of the Spring MVC Test framework is. It simulates the internals of Spring MVC.

MockMVC is the key part of the Spring MVC Test framework is. It simulates the internals of Spring MVC.

742 questions
-1
votes
1 answer

Spring Boot test - Is there any way to run ALL test code on production server startup?

I have several test codes for APIs that are important than others. They do the test with MockMvc and are placed in 'test' package, seperated from the original codes. Is there any way to run all of the test codes when production server (the…
Flippingflop
  • 187
  • 1
  • 1
  • 11
-1
votes
1 answer

How can i test below function using MockMvc?

So I've got a controller class and want to test it, but don't know how. I have been trying to use MockMvc but don't know how to actually pass the query parameters. My code is as follows: public class AppointmentController { @GetMapping(path =…
-1
votes
1 answer

When using MockMvc to test the controller, a parameter passing error occurred

I am using MockMvc to test the controller. Regarding parameter import, I encountered a type mismatch problem. I tried all the json styles.But nothing works This is my controller class:: package app.dnatask.controller; import…
-1
votes
1 answer

Spring Boot Unit Test MockMVC throws BadRequest eventhough there exists API for it

I have attempted to write a test for POST method for the Controller API quiz Its GET call work correctly but not POST. UnitTest(fails): private static final String url = "/quiz"; . . . @Test public void…
Smit
  • 2,078
  • 2
  • 17
  • 40
-1
votes
1 answer

MockMVC tests how can I verify the answer

I have a following test method in mockMVC I need to improve the tests to make sense. at the moment tests are not testing, how to improve to test? just add verification of data compliance? how to add it? What could be the example of data validation…
martine
  • 79
  • 2
  • 3
  • 10
-1
votes
1 answer

what is the idea and use of when(mock.method()).thenReturn(someValue) in mockito

In many tutorials found examples with following similar statement when(mock.method()).thenReturn(someValue); Can anyone please trigger out why this is used?? Is that invoking the method and expecting the result as such given inside thenReturn()…
1 2 3
49
50