Comments (5)
Thanks for your report.
Could you please elaborate on this error?
All this library does is map POJO fields to HTTP request parameters. This "handler" error seems to be related to a missing handler mapping. Is your handler (ie. PostMapping
annotated method) discovered? -> Can you see the /myapp/path
path in the startup logs? Spring logs the discovered mappings under the org.springframework.web.servlet.HandlerMapping.Mappings
logger.
Also, did you register your controller with the MockMvc
instance you use in your tests?
[...]
mockMvc = MockMvcBuilders.standaloneSetup(new UserController())
[...]
from spring-mvc-test-utils.
The test class is annotated with @WebMvcTest(MyController.class)
and I autowire MockMvc
. It's correctly picking up other methods which are being tested with standard MockMvcRequestBuilders.get but for some reason this method that has @PostMapping({"/path"})
just isn't playing ball.
I've been trying to recreate the problem in a test on spring-mvc-test-utils (hence PR #131) but it may just be a problem my end as you say. I'll try updating the logger and see what's happening there
from spring-mvc-test-utils.
Thanks for your reply 👍
Don't hesitate if you need more help 🙏
from spring-mvc-test-utils.
This has turned into a real pita. All tests for methods with @GetMapping
work fine but if I test anything with @PostMapping
then mockMvc fails to find a handler:
Handler:
Type = null
this is the same whether I write the test using MockServerHttpRequest.post or MockMvcRequestBuilderUtils.postForm.
from spring-mvc-test-utils.
Thanks for your feedback. Feel free to share some code if you need help :)
from spring-mvc-test-utils.
Related Issues (9)
- breaks tests when run from maven HOT 5
- update for Spring Boot 2.6 HOT 4
- Exclude static and transient fields from form fields by default HOT 8
- Use SLF4J instead of Apache Commons Logging
- Migrate to JUnit 5
- Possible bug while using with complex type objects? (Missing `Map` support) HOT 10
- Add support for Numbers classes
- Support multidimensional arrays and maps HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from spring-mvc-test-utils.