fix GET /user/purchase
Change-Id: I09ae5c51e446a6cab135ab4552e5a0726bc0f629
diff --git a/src/test/java/com/g9/g9backend/controller/UserControllerTest.java b/src/test/java/com/g9/g9backend/controller/UserControllerTest.java
index bb768a0..216cdf2 100644
--- a/src/test/java/com/g9/g9backend/controller/UserControllerTest.java
+++ b/src/test/java/com/g9/g9backend/controller/UserControllerTest.java
@@ -61,6 +61,18 @@
@Mock
private ThreadService threadService;
+ @Mock
+ private GameplayService gameplayService;
+
+ @Mock
+ private ResourceVersionService resourceVersionService;
+
+ @Mock
+ private GameVersionService gameVersionService;
+
+ @Mock
+ private TorrentRecordService torrentRecordService;
+
private final ObjectMapper objectMapper = new ObjectMapper();
@BeforeEach
@@ -335,6 +347,14 @@
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, "mod"));
+ List<Gameplay> gameplayList = new ArrayList<>();
+ when(gameplayService.list(new QueryWrapper<Gameplay>().eq("resource_id", 1))).thenReturn(gameplayList);
+ List<ResourceVersion> resourceVersionList = new ArrayList<>();
+ when(resourceVersionService.list(new QueryWrapper<ResourceVersion>().eq("resource_id", 1))).thenReturn(resourceVersionList);
+ List<GameVersion> gameVersionList = new ArrayList<>();
+ when( gameVersionService.list(new QueryWrapper<GameVersion>().eq("resource_version_id", 1))).thenReturn(gameVersionList);
+ List<TorrentRecord> torrentRecordList = new ArrayList<>();
+ when(torrentRecordService.list(new QueryWrapper<TorrentRecord>().eq("resource_version_id", 1))).thenReturn(torrentRecordList);
mockMvc.perform(get("/user/purchase")
.param("userId", "1")