我有一个 Spring Boot v1.5.14.RELEASE 应用程序,使用 Spring Initializer、JPA、嵌入式 Tomcat 并遵循 RESTful API 架构原则。我创建了这个测试
@Test
public void createCustomerChain() throws Exception {
this.mockMvc.perform(post("/customer/createCustomer")
.contentType(MediaType.APPLICATION_JSON_VALUE)
.content("{\n" +
" \"subSegment\":\"25\",\n" +
" \"legalLanguage\":\"NL\",\n" +
" \"isRestrictel\":true,\n" +
" \"isCommunicationLanguageForAllAccount\":true,\n" +
" \"isAntiMarketing\":true,\n" +
" \"hotelChain\":{\n" +
" \"legalForm\":\"09\",\n" +
" \"foundationDate\":\"2001-12-17T09:30:47Z\",\n" +
" \"tradingName\":\"COMPANY NAME\",\n" +
" \"printName\":\"TEST PRINT\",\n" +
" \"naceCode\":\"16230\",\n" +
" \"vatNumber\":\"41223334343\", \n" +
" \"countryVatCode\":\"IN\",\n" +
" \"isSubjectToVAT\":true,\n" +
" \"sectorCode\":\"85\",\n" +
" \"legalAddress\": {\n" +
" \"mainkey\":2088512,\n" +
" \"subkey\":3256\n" +
}
这是运行测试的结果:
org.springframework.restdocs.snippet.SnippetException: Fields with the following paths were not found in the payload: [customerId]
customerId并从测试中删除fieldWithPath成功通过但是,我想知道为什么我对这样的字段没有相同的错误billingAccountId
当年话下
相关分类