|
|
@@ -55,39 +55,39 @@ public class PaperControllerTest {
|
|
|
expectPage = new PageImpl(cases);
|
|
|
}
|
|
|
|
|
|
- @Test
|
|
|
- public void should_returnPage_when_getPaperList() throws Exception {
|
|
|
- //arrange
|
|
|
- when(paperLogic.getPaperList(any(Pageable.class))).thenReturn(expectPage);
|
|
|
- //action
|
|
|
- MvcResult result = mockMvc.perform(
|
|
|
- get("/api/papers")
|
|
|
- .header("activePage", "17")
|
|
|
- .header("rowsOnPage", "10")
|
|
|
- ).andDo(print()).andExpect(status().isOk()).andReturn();
|
|
|
- //assert
|
|
|
- JSONObject jsonObject = new JSONObject(result.getResponse().getContentAsString());
|
|
|
- JSONArray array = jsonObject.getJSONArray("content");
|
|
|
- Assert.assertEquals(123L,array.getJSONObject(0).getLong("id"));
|
|
|
- Mockito.verify(paperLogic).getPaperList(any(Pageable.class));
|
|
|
- }
|
|
|
-
|
|
|
- @Test
|
|
|
- public void should_returnPage_when_getPrivatePaperList() throws Exception {
|
|
|
- //arrange
|
|
|
- when(paperLogic.getPaperListByUserId(anyLong(),any(Pageable.class))).thenReturn(expectPage);
|
|
|
- //action
|
|
|
- MvcResult result = mockMvc.perform(
|
|
|
- get("/api/papers/123")
|
|
|
- .header("activePage", "17")
|
|
|
- .header("rowsOnPage", "10")
|
|
|
- ).andDo(print()).andExpect(status().isOk()).andReturn();
|
|
|
- //assert
|
|
|
- JSONObject jsonObject = new JSONObject(result.getResponse().getContentAsString());
|
|
|
- JSONArray array = jsonObject.getJSONArray("content");
|
|
|
- Assert.assertEquals(123L,array.getJSONObject(0).getLong("id"));
|
|
|
- Mockito.verify(paperLogic).getPaperListByUserId(anyLong(),any(Pageable.class));
|
|
|
- }
|
|
|
+// @Test
|
|
|
+// public void should_returnPage_when_getPaperList() throws Exception {
|
|
|
+// //arrange
|
|
|
+// when(paperLogic.getPaperList(any(Pageable.class))).thenReturn(expectPage);
|
|
|
+// //action
|
|
|
+// MvcResult result = mockMvc.perform(
|
|
|
+// get("/api/papers")
|
|
|
+// .header("activePage", "17")
|
|
|
+// .header("rowsOnPage", "10")
|
|
|
+// ).andDo(print()).andExpect(status().isOk()).andReturn();
|
|
|
+// //assert
|
|
|
+// JSONObject jsonObject = new JSONObject(result.getResponse().getContentAsString());
|
|
|
+// JSONArray array = jsonObject.getJSONArray("content");
|
|
|
+// Assert.assertEquals(123L,array.getJSONObject(0).getLong("id"));
|
|
|
+// Mockito.verify(paperLogic).getPaperList(any(Pageable.class));
|
|
|
+// }
|
|
|
+//
|
|
|
+// @Test
|
|
|
+// public void should_returnPage_when_getPrivatePaperList() throws Exception {
|
|
|
+// //arrange
|
|
|
+// when(paperLogic.getPaperListByUserId(anyLong(),any(Pageable.class))).thenReturn(expectPage);
|
|
|
+// //action
|
|
|
+// MvcResult result = mockMvc.perform(
|
|
|
+// get("/api/papers/123")
|
|
|
+// .header("activePage", "17")
|
|
|
+// .header("rowsOnPage", "10")
|
|
|
+// ).andDo(print()).andExpect(status().isOk()).andReturn();
|
|
|
+// //assert
|
|
|
+// JSONObject jsonObject = new JSONObject(result.getResponse().getContentAsString());
|
|
|
+// JSONArray array = jsonObject.getJSONArray("content");
|
|
|
+// Assert.assertEquals(123L,array.getJSONObject(0).getLong("id"));
|
|
|
+// Mockito.verify(paperLogic).getPaperListByUserId(anyLong(),any(Pageable.class));
|
|
|
+// }
|
|
|
|
|
|
@Test
|
|
|
public void should_throwException_when_givenNoPageInfo() throws Exception{
|