第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定

請教老師:如何在controller中通過json測試呢

老師您說:可以測試json,就好奇問問。如何編寫。

正在回答

2 回答

有沒有好心人幫助看一下呀

0 回復(fù) 有任何疑惑可以回復(fù)我~
public?interface?ResultActions?{

???/**
????*?Perform?an?expectation.
????*
????*?<h4>Example</h4>
????*?<pre?class="code">
????*?static?imports:?MockMvcRequestBuilders.*,?MockMvcResultMatchers.*
????*
????*?mockMvc.perform(get("/person/1"))
????*???.andExpect(status().isOk())
????*???.andExpect(content().contentType(MediaType.APPLICATION_JSON))
????*???.andExpect(jsonPath("$.person.name").value("Jason"));
????*
????*?mockMvc.perform(post("/form"))
????*???.andExpect(status().isOk())
????*???.andExpect(redirectedUrl("/person/1"))
????*???.andExpect(model().size(1))
????*???.andExpect(model().attributeExists("person"))
????*???.andExpect(flash().attributeCount(1))
????*???.andExpect(flash().attribute("message",?"success!"));
????*?</pre>
????*/
???ResultActions?andExpect(ResultMatcher?matcher)?throws?Exception;

???/**
????*?Perform?a?general?action.
????*
????*?<h4>Example</h4>
????*?<pre?class="code">
????*?static?imports:?MockMvcRequestBuilders.*,?MockMvcResultMatchers.*
????*
????*?mockMvc.perform(get("/form")).andDo(print());
????*?</pre>
????*/
???ResultActions?andDo(ResultHandler?handler)?throws?Exception;

???/**
????*?Return?the?result?of?the?executed?request?for?direct?access?to?the?results.
????*
????*?@return?the?result?of?the?request
????*/
???MvcResult?andReturn();

}

看了一下源碼,我試試,請老師,伙伴們回復(fù)下

0 回復(fù) 有任何疑惑可以回復(fù)我~
#1

HeroChan 提問者

java.lang.AssertionError: No value at JSON path "$.person.name", exception: Missing property in path $['person'] body中可以顯示數(shù)據(jù),但是報這個錯誤。我再看看,先去吃飯 了。
2017-08-06 回復(fù) 有任何疑惑可以回復(fù)我~

舉報

0/150
提交
取消

請教老師:如何在controller中通過json測試呢

我要回答 關(guān)注問題
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號