首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >如何调试错误: java.lang.AssertionError:在JSON路径"$.name“上没有值

如何调试错误: java.lang.AssertionError:在JSON路径"$.name“上没有值
EN

Stack Overflow用户
提问于 2021-06-30 12:18:12
回答 3查看 2.2K关注 0票数 1

我正在编写一个应用程序,它的目的是帮助普通医生治疗老年人。我们的目标是避免多药,它是基于ATC (解剖治疗化学)分类。我编写了一种将活性物质添加到DB的方法,它可以工作(我在h2 db上检查过它),但我无法编写适当的测试。

我怎么调查这个问题?

这是我的考试课:

代码语言:javascript
运行
复制
package com.example.geriafarm.controllers;


import com.example.geriafarm.DTO.ATCdto;
import com.example.geriafarm.DTO.ActiveSubstDTO;
import com.example.geriafarm.entities.ATC;
import com.example.geriafarm.entities.ActiveSubst;
import com.example.geriafarm.repositories.ActiveSubstRepository;
import com.example.geriafarm.services.ATCService;
import com.example.geriafarm.services.ActiveSubstService;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.http.MediaType;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.ResultMatcher;
import org.springframework.transaction.annotation.Transactional;

import java.util.UUID;

import static java.lang.String.format;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.when;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
import static org.hamcrest.Matchers.is;

@SpringBootTest
@AutoConfigureMockMvc
public class ActiveSubstControllerTest {

    @Autowired
    private MockMvc mockMvc;

    @MockBean
    private ActiveSubstService activeSubstService;

    @Autowired
    ActiveSubstRepository activeSubstRepository;


    @Test
    @Transactional
    void shouldAddActiveSubstance() throws Exception {
        final UUID id = new UUID(1234,567);
        final String testName = "furosemid";
        final String atcDTOTest = "C03CA01";
        final ATC testATC = new ATC(null, "C","03","C","A","01");
        final ActiveSubst activeSubstTest = new ActiveSubst(id,testName, testATC);

        when(activeSubstService.addSubstance(any(ActiveSubstDTO.class))).thenReturn(activeSubstTest.getId());

        mockMvc.perform(
                post("/activesubstances")
                    .contentType(MediaType.APPLICATION_JSON)
                    .content(format("{\"name\":\"%s\",\"atc\":\"%s\"}",  testName, atcDTOTest)))
                .andDo(print())
                .andExpect(status().isCreated())
                .andExpect(jsonPath("$.name", is(testName)))
                .andExpect(jsonPath("$.atc", is(atcDTOTest)));

    }
}

这是ActiveSubstanceService类:

代码语言:javascript
运行
复制
package com.example.geriafarm.services.implementation;

import com.example.geriafarm.DTO.ATCdto;
import com.example.geriafarm.DTO.ActiveSubstDTO;
import com.example.geriafarm.entities.ATC;
import com.example.geriafarm.entities.ActiveSubst;
import com.example.geriafarm.repositories.ATCRepository;
import com.example.geriafarm.repositories.ActiveSubstRepository;
import com.example.geriafarm.services.ActiveSubstService;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Optional;
import java.util.UUID;

@Service
public class DefaultActiveSubstService implements ActiveSubstService {

    private final ActiveSubstRepository activeSubstRepository;
    private final ATCRepository atcRepository;

    public DefaultActiveSubstService(ActiveSubstRepository activeSubstRepository, ATCRepository atcRepository) {
        this.activeSubstRepository = activeSubstRepository;
        this.atcRepository = atcRepository;
    }

    @Override
    public List<ActiveSubstDTO> getSubstances() {
        return null;
    }

    public static ATC createATCEntity(ATCdto atcDto) { //metoda przepisuje dane z frontendu(ATCdto) do poszczególnych pól w bazie danych
        ATC atcEntity = new ATC();
        atcEntity.setAnatomicalGr(atcDto.getAtcDto().substring(0, 1));
        atcEntity.setTherapeutSubgr(atcDto.getAtcDto().substring(1, 3));
        atcEntity.setPharmacolSubgr(atcDto.getAtcDto().substring(3, 4));
        atcEntity.setChemicalSubgr(atcDto.getAtcDto().substring(4, 5));
        atcEntity.setChemicalSubst(atcDto.getAtcDto().substring(5));
        return atcEntity;
    }

    @Override
    public UUID addSubstance(ActiveSubstDTO activeSubstDTO) {


        final ActiveSubst activeSubst = activeSubstRepository.saveAndFlush(new ActiveSubst(null, activeSubstDTO.getName(), createATCEntity(activeSubstDTO.getAtc())
                )

        );

        return activeSubst.getId();
    }

    @Override
    public Optional<ActiveSubstDTO> getSubstanceById(String id) {
        return activeSubstRepository.findById(UUID.fromString(id)).map(ActiveSubstDTO::fromActiveSubstEnt);

    }

    @Override
    public ActiveSubstDTO updateSubstance(String id, ActiveSubstDTO activeSubstDTO) {
        return null;
    }

    @Override
    public List<ActiveSubstDTO> getSubstancesByMedicine(UUID medicineId) {
        return null;
    }

    @Override
    public List<ActiveSubstDTO> getSubstancesByAnatomicalGroup(ATCdto atcDto) {
        return null;
    }

    @Override
    public List<ActiveSubstDTO> getSubstancesByTherapeuticSubgroup(ATCdto atcDto) {
        return null;
    }
}

最后,控制器:

代码语言:javascript
运行
复制
package com.example.geriafarm.controllers;

import com.example.geriafarm.DTO.ActiveSubstDTO;
import com.example.geriafarm.exceptions.GeriaException;
import com.example.geriafarm.services.ActiveSubstService;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.net.URI;
import java.net.URISyntaxException;
import java.util.UUID;

@RestController
@RequestMapping("/activesubstances")
public class ActiveSubstController {

    private final ActiveSubstService activeSubstService;

    public ActiveSubstController(ActiveSubstService activeSubstService) {
        this.activeSubstService = activeSubstService;
    }

    @PostMapping
    public ResponseEntity<Void> addActiveSubst (@RequestBody ActiveSubstDTO activeSubstDTO) throws GeriaException, URISyntaxException {
        UUID activeSubstId = activeSubstService.addSubstance(activeSubstDTO);

        return ResponseEntity
                .created(new URI("/activesubstances/" + activeSubstId))
                .build();
    }


}

编辑:下面是我得到的一系列错误:

代码语言:javascript
运行
复制
MockHttpServletRequest:
      HTTP Method = POST
      Request URI = /activesubstances
       Parameters = {}
          Headers = [Content-Type:"application/json;charset=UTF-8", Content-Length:"36"]
             Body = {"name":"furosemid","atc":"C03CA01"}
    Session Attrs = {}

Handler:
             Type = com.example.geriafarm.controllers.ActiveSubstController
           Method = com.example.geriafarm.controllers.ActiveSubstController#addActiveSubst(ActiveSubstDTO)

Async:
    Async started = false
     Async result = null

Resolved Exception:
             Type = null

ModelAndView:
        View name = null
             View = null
            Model = null

FlashMap:
       Attributes = null

MockHttpServletResponse:
           Status = 201
    Error message = null
          Headers = [Location:"/activesubstances/00000000-0000-04d2-0000-000000000237"]
     Content type = null
             Body = 
    Forwarded URL = null
   Redirected URL = /activesubstances/00000000-0000-04d2-0000-000000000237
          Cookies = []

MockHttpServletRequest:
      HTTP Method = POST
      Request URI = /activesubstances
       Parameters = {}
          Headers = [Content-Type:"application/json;charset=UTF-8", Content-Length:"36"]
             Body = {"name":"furosemid","atc":"C03CA01"}
    Session Attrs = {}

Handler:
             Type = com.example.geriafarm.controllers.ActiveSubstController
           Method = com.example.geriafarm.controllers.ActiveSubstController#addActiveSubst(ActiveSubstDTO)

Async:
    Async started = false
     Async result = null

Resolved Exception:
             Type = null

ModelAndView:
        View name = null
             View = null
            Model = null

FlashMap:
       Attributes = null

MockHttpServletResponse:
           Status = 201
    Error message = null
          Headers = [Location:"/activesubstances/00000000-0000-04d2-0000-000000000237"]
     Content type = null
             Body = 
    Forwarded URL = null
   Redirected URL = /activesubstances/00000000-0000-04d2-0000-000000000237
          Cookies = []
2021-06-30 17:45:11.429  INFO 20568 --- [           main] o.s.t.c.transaction.TransactionContext   : Rolled back transaction for test: [DefaultTestContext@43aaf813 testClass = ActiveSubstControllerTest, testInstance = com.example.geriafarm.controllers.ActiveSubstControllerTest@7d28efd5, testMethod = shouldAddActiveSubstance@ActiveSubstControllerTest, testException = java.lang.AssertionError: No value at JSON path "$.name", mergedContextConfiguration = [WebMergedContextConfiguration@57ac5227 testClass = ActiveSubstControllerTest, locations = '{}', classes = '{class com.example.geriafarm.GeriafarmApplication}', contextInitializerClasses = '[]', activeProfiles = '{}', propertySourceLocations = '{}', propertySourceProperties = '{org.springframework.boot.test.context.SpringBootTestContextBootstrapper=true}', contextCustomizers = set[[ImportsContextCustomizer@4ba302e0 key = [org.springframework.boot.test.autoconfigure.web.servlet.MockMvcAutoConfiguration, org.springframework.boot.test.autoconfigure.web.servlet.MockMvcWebClientAutoConfiguration, org.springframework.boot.test.autoconfigure.web.servlet.MockMvcWebDriverAutoConfiguration, org.springframework.boot.autoconfigure.security.oauth2.client.servlet.OAuth2ClientAutoConfiguration, org.springframework.boot.autoconfigure.security.oauth2.resource.servlet.OAuth2ResourceServerAutoConfiguration, org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration, org.springframework.boot.autoconfigure.security.servlet.SecurityFilterAutoConfiguration, org.springframework.boot.autoconfigure.security.servlet.UserDetailsServiceAutoConfiguration, org.springframework.boot.test.autoconfigure.web.servlet.MockMvcSecurityConfiguration]], org.springframework.boot.test.context.filter.ExcludeFilterContextCustomizer@23202fce, org.springframework.boot.test.json.DuplicateJsonObjectContextCustomizerFactory$DuplicateJsonObjectContextCustomizer@6f1c29b7, org.springframework.boot.test.mock.mockito.MockitoContextCustomizer@763dd5d5, org.springframework.boot.test.web.client.TestRestTemplateContextCustomizer@2b72cb8a, org.springframework.boot.test.autoconfigure.actuate.metrics.MetricsExportContextCustomizerFactory$DisableMetricExportContextCustomizer@5d99c6b5, org.springframework.boot.test.autoconfigure.properties.PropertyMappingContextCustomizer@4b3fa0b3, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverContextCustomizerFactory$Customizer@52e7a6b2, org.springframework.boot.test.context.SpringBootTestArgs@1, org.springframework.boot.test.context.SpringBootTestWebEnvironment@133e16fd], resourceBasePath = 'src/main/webapp', contextLoader = 'org.springframework.boot.test.context.SpringBootContextLoader', parent = [null]], attributes = map['org.springframework.test.context.web.ServletTestExecutionListener.activateListener' -> true, 'org.springframework.test.context.web.ServletTestExecutionListener.populatedRequestContextHolder' -> true, 'org.springframework.test.context.web.ServletTestExecutionListener.resetRequestContextHolder' -> true, 'org.springframework.test.context.event.ApplicationEventsTestExecutionListener.recordApplicationEvents' -> false]]

java.lang.AssertionError: No value at JSON path "$.name"

    at org.springframework.test.util.JsonPathExpectationsHelper.evaluateJsonPath(JsonPathExpectationsHelper.java:304)
    at org.springframework.test.util.JsonPathExpectationsHelper.assertValue(JsonPathExpectationsHelper.java:73)
    at org.springframework.test.web.servlet.result.JsonPathResultMatchers.lambda$value$0(JsonPathResultMatchers.java:87)
    at org.springframework.test.web.servlet.MockMvc$1.andExpect(MockMvc.java:196)
    at com.example.geriafarm.controllers.ActiveSubstControllerTest.shouldAddActiveSubstance(ActiveSubstControllerTest.java:63)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:688)
    at org.junit.jupiter.engine.execution.MethodInvocation.proceed(MethodInvocation.java:60)
    at org.junit.jupiter.engine.execution.InvocationInterceptorChain$ValidatingInvocation.proceed(InvocationInterceptorChain.java:131)
    at org.junit.jupiter.engine.extension.TimeoutExtension.intercept(TimeoutExtension.java:149)
    at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestableMethod(TimeoutExtension.java:140)
    at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestMethod(TimeoutExtension.java:84)
    at org.junit.jupiter.engine.execution.ExecutableInvoker$ReflectiveInterceptorCall.lambda$ofVoidMethod$0(ExecutableInvoker.java:115)
    at org.junit.jupiter.engine.execution.ExecutableInvoker.lambda$invoke$0(ExecutableInvoker.java:105)
    at org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptedInvocation.proceed(InvocationInterceptorChain.java:106)
    at org.junit.jupiter.engine.execution.InvocationInterceptorChain.proceed(InvocationInterceptorChain.java:64)
    at org.junit.jupiter.engine.execution.InvocationInterceptorChain.chainAndInvoke(InvocationInterceptorChain.java:45)
    at org.junit.jupiter.engine.execution.InvocationInterceptorChain.invoke(InvocationInterceptorChain.java:37)
    at org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:104)
    at org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:98)
    at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeTestMethod$6(TestMethodTestDescriptor.java:210)
    at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
    at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeTestMethod(TestMethodTestDescriptor.java:206)
    at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:131)
    at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:65)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:139)
    at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:129)
    at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:127)
    at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:126)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:84)
    at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
    at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:38)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:143)
    at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:129)
    at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:127)
    at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:126)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:84)
    at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
    at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:38)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:143)
    at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:129)
    at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:127)
    at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:126)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:84)
    at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:32)
    at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57)
    at org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:51)
    at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:108)
    at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:88)
    at org.junit.platform.launcher.core.EngineExecutionOrchestrator.lambda$execute$0(EngineExecutionOrchestrator.java:54)
    at org.junit.platform.launcher.core.EngineExecutionOrchestrator.withInterceptedStreams(EngineExecutionOrchestrator.java:67)
    at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:52)
    at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:96)
    at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:75)
    at com.intellij.junit5.JUnit5IdeaTestRunner.startRunnerWithArgs(JUnit5IdeaTestRunner.java:71)
    at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33)
    at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:221)
    at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:54)
Caused by: java.lang.IllegalArgumentException: json can not be null or empty
    at com.jayway.jsonpath.internal.Utils.notEmpty(Utils.java:386)
    at com.jayway.jsonpath.JsonPath.read(JsonPath.java:342)
    at com.jayway.jsonpath.JsonPath.read(JsonPath.java:329)
    at org.springframework.test.util.JsonPathExpectationsHelper.evaluateJsonPath(JsonPathExpectationsHelper.java:301)
    ... 69 more

我对Java和一般的编码都很陌生。

EN

回答 3

Stack Overflow用户

回答已采纳

发布于 2021-06-30 14:03:20

你能把这堆错误放在你的问题上吗?

也许您的json从返回的请求体,没有一个财产与“名称”。

随着你的堆栈,你的身体从回报是空的。

代码语言:javascript
运行
复制
MockHttpServletResponse:
           Status = 201
    Error message = null
          Headers = [Location:"/activesubstances/00000000-0000-04d2-0000-000000000237"]
     Content type = null
             Body = 
    Forwarded URL = null
   Redirected URL = /activesubstances/00000000-0000-04d2-0000-000000000237
          Cookies = []

您可以删除以下内容的测试:

代码语言:javascript
运行
复制
mockMvc.perform(
                post("/activesubstances")
                    .contentType(MediaType.APPLICATION_JSON)
                    .content(format("{\"name\":\"%s\",\"atc\":\"%s\"}",  testName, atcDTOTest)))
                .andDo(print())
                .andExpect(status().isCreated())

或者您可以将responseEntity从控制器中放入,以返回包含信息的DTO对象,并对其进行检查。

票数 0
EN

Stack Overflow用户

发布于 2021-06-30 14:08:09

在查看代码之后,您的POST方法不返回nameatc作为其一部分的JSON有效负载。

代码语言:javascript
运行
复制
@PostMapping
public ResponseEntity<Void> addActiveSubst (@RequestBody ActiveSubstDTO activeSubstDTO) throws GeriaException, URISyntaxException {
    UUID activeSubstId = activeSubstService.addSubstance(activeSubstDTO);

    return ResponseEntity
                .created(new URI("/activesubstances/" + activeSubstId))
                .build();  // <-- you are returning an UUID only.
}

在您的测试中,您断言您希望在.andExpect(jsonPath("$.name", is(testName)))响应中使用.andExpect(jsonPath("$.atc", is(atcDTOTest))),这与Controller不匹配。

你可以用这个试一试。最后,断言必须与Controller方法的输出相匹配。

代码语言:javascript
运行
复制
mockMvc.perform(
                post("/activesubstances")
                    .contentType(MediaType.APPLICATION_JSON)
                    .content(format("{\"name\":\"%s\",\"atc\":\"%s\"}",  testName, atcDTOTest)))
                .andDo(print())
                .andExpect(status().isCreated());

编辑:添加了关于这个答案的最后一个评论,并修改了以反映最后的建议。

票数 3
EN

Stack Overflow用户

发布于 2021-06-30 17:39:47

在控制器中,返回一个空体(ResponseEntity<Void>),其中包含一个Location头:

代码语言:javascript
运行
复制
        return ResponseEntity
                .created(new URI("/activesubstances/" + activeSubstId))
                .build();

在测试中,您需要一个包含nameatc字段的JSON:

代码语言:javascript
运行
复制
                .andExpect(jsonPath("$.name", is(testName)))
                .andExpect(jsonPath("$.atc", is(atcDTOTest)));

因此,测试是正确的失败。

你要解决的是:

如果您想返回一个空体,请从测试中删除前面提到的行。如果您想在响应体中返回JSON (我猜您期望它是ResponseEntity<ActiveSubstDTO>).?),则必须返回适当的ResponseEntity<YourResponseType> (例如,Location )。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/68194612

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档