user module API & resource module API
GET /user/thread
POST /resource/version
GET /resource/search
GET /resource/info
GET /resource/hot
GET /resource/hot/slide
GET /resource/hot-trend
PUT /resource/info
Change-Id: I39c94b06a1d69967b8e235a67a0133c8095abb38
diff --git a/src/test/java/com/g9/g9backend/controller/UserControllerTest.java b/src/test/java/com/g9/g9backend/controller/UserControllerTest.java
index d390dea..76db7ee 100644
--- a/src/test/java/com/g9/g9backend/controller/UserControllerTest.java
+++ b/src/test/java/com/g9/g9backend/controller/UserControllerTest.java
@@ -58,6 +58,9 @@
@Mock
private ResourceService resourceService;
+ @Mock
+ private ThreadService threadService;
+
private final ObjectMapper objectMapper = new ObjectMapper();
@BeforeEach
@@ -303,7 +306,7 @@
public void testGetUserCollection() throws Exception {
when(userCollectionService.page(any(), any())).thenReturn(new Page<>(1, 2));
- when(resourceService.getById(anyInt())).thenReturn(new Resource(1, "a", null, null, null, new Date(), new Date(), 100, 0, 0, 0, 0, 0, "mod"));
+ when(resourceService.getById(anyInt())).thenReturn(new Resource(1, "a", null, null, null, new Date(), new Date(), 100, 0, 0, 0, 0, "mod"));
mockMvc.perform(get("/user/collection")
.param("userId", "1")
@@ -317,7 +320,7 @@
public void testGetUserUpload() throws Exception {
when(userUploadService.page(any(), any())).thenReturn(new Page<>(1, 2));
- when(resourceService.getById(anyInt())).thenReturn(new Resource(1, "a", null, null, null, new Date(), new Date(), 100, 0, 0, 0, 0, 0, "mod"));
+ when(resourceService.getById(anyInt())).thenReturn(new Resource(1, "a", null, null, null, new Date(), new Date(), 100, 0, 0, 0, 0, "mod"));
mockMvc.perform(get("/user/upload")
.param("userId", "1")
@@ -331,7 +334,7 @@
public void testGetUserPurchase() throws Exception {
when(userPurchaseService.page(any(), any())).thenReturn(new Page<>(1, 2));
- when(resourceService.getById(anyInt())).thenReturn(new Resource(1, "a", null, null, null, new Date(), new Date(), 100, 0, 0, 0, 0, 0, "mod"));
+ when(resourceService.getById(anyInt())).thenReturn(new Resource(1, "a", null, null, null, new Date(), new Date(), 100, 0, 0, 0, 0, "mod"));
mockMvc.perform(get("/user/purchase")
.param("userId", "1")
@@ -356,6 +359,19 @@
.andExpect(status().isOk());
}
+ // 获取发布过的贴子
+ @Test
+ public void testGetUserThread() throws Exception {
+
+ when(threadService.page(any(), any())).thenReturn(new Page<>(1, 2));
+
+ mockMvc.perform(get("/user/thread")
+ .param("userId", "1")
+ .param("pageNumber", "1")
+ .param("rows", "2"))
+ .andExpect(status().isOk());
+ }
+
// 获取用户数据
@Test
public void testGetUserData() throws Exception {