使用Spring Boot。TransactionCategory
是enum
:
public enum TransactionCategory {
AUCTION,
NORMAL,
NEWS,
DILIGENT,
DUAGE
}
以下是控制器:
@PutMapping("/status")
public ApiResult<Boolean> setCollectedTransaction(
@RequestBody TransactionCategory category) {
ApiResult<Boolean> result = new ApiResult<>();
return result;
}
我想这样放置TransactionCategory
:
@Test
public void setCollectedTransaction() throws Exception {
MvcResult result = this.mockMvc.perform(put("/status")
.content("{ \"category\": \"NEWS\" }")
.contentType(MediaType.APPLICATION_JSON))
但是它总是说Can not deserialize instance of out of START_OBJECT token
。这是什么问题?