【SpringBoot】测试Control接口方法

测试Controller接口方法:

执行单元测试:

MockHttpServletRequest:

HTTP Method = POST

Request URI = /hello

Parameters = { }

Headers = Content-Type:"application/json;charset=UTF-8"

Body = null

Session Attrs = { }

Handler:

Type = com.weiz.helloworld.web.HelloContrller

Method = com.weiz.helloworld.web.HelloController#hello()

Async:

Async started =false

Async result = null

Resolved Exception:

Type = null

ModelAndView:

View name = null

View = null

Model = null

FlashMap:

Attributes = null

MockHttpServletResponse:

Status = 200

Error message = null

Headers = Content-Type:"text/plain;charset=UTF-8",Content-Length:"17"

Content type = text/plain;charset=UTF-8

Body = hello Spring Boot

Forward URL = null

Redirected URL = null

Cookies =

相关推荐
球king6 分钟前
CC GUI 插件:在 IDEA 中使用 CodeX
java·ide·intellij-idea
宠友信息7 分钟前
多端即时通讯源码技术实践,Redis路由、MySQL持久化与Socket接入
spring boot·websocket·mysql·uni-app
豆瓣鸡35 分钟前
网关、服务 userId 透传
java·微服务·gateway
bksczm43 分钟前
Linux之信号量(POSIX标准)
java·开发语言
Tom·Ge1 小时前
【Spring Boot 4】Spring Boot 4.0 AI Agent实战:Skills Agent + MCP协议集成
人工智能·spring boot·microsoft
Devin~Y1 小时前
电商场景下的Java面试实战:从Spring Boot微服务到Kafka、Redis与AI RAG
java·spring boot·redis·elasticsearch·spring cloud·微服务·kafka
吠品1 小时前
PHP里取月份最后一天的几种方式
java·开发语言·eureka
gugucoding1 小时前
2. 【Java】搭建Java开发环境
java·开发语言
wang09072 小时前
自己动手写一个spring之MVC_3
java·spring·mvc
闲猫2 小时前
Spring AI / Models / Chat Models / Ollama
java·人工智能·spring