|
@@ -0,0 +1,32 @@
|
|
|
|
|
+package cn.reghao.tnb.content.app.vod.service;
|
|
|
|
|
+
|
|
|
|
|
+import cn.reghao.tnb.content.app.vod.db.mapper.VideoPostMapper;
|
|
|
|
|
+import cn.reghao.tnb.content.app.vod.db.mongo.UserCommentMongo;
|
|
|
|
|
+import org.junit.Test;
|
|
|
|
|
+import org.junit.runner.RunWith;
|
|
|
|
|
+import org.mockito.InjectMocks;
|
|
|
|
|
+import org.mockito.Mock;
|
|
|
|
|
+import org.mockito.Mockito;
|
|
|
|
|
+import org.mockito.junit.MockitoJUnitRunner;
|
|
|
|
|
+
|
|
|
|
|
+/**
|
|
|
|
|
+ * @author reghao
|
|
|
|
|
+ * @date 2025-05-29 09:16:31
|
|
|
|
|
+ */
|
|
|
|
|
+@RunWith(MockitoJUnitRunner.class)
|
|
|
|
|
+public class UnitTest {
|
|
|
|
|
+ @Mock
|
|
|
|
|
+ private UserCommentMongo userCommentMongo;
|
|
|
|
|
+ //@Mock
|
|
|
|
|
+ private VideoPostMapper videoPostMapper;
|
|
|
|
|
+ @InjectMocks
|
|
|
|
|
+ CommentService commentService;
|
|
|
|
|
+
|
|
|
|
|
+ @Test
|
|
|
|
|
+ public void unitTest() {
|
|
|
|
|
+ String videoId = "abcdefg";
|
|
|
|
|
+ Mockito.when(userCommentMongo.countByPostId(videoId)).thenReturn(1024L);
|
|
|
|
|
+ long total = commentService.countPostComment(videoId);
|
|
|
|
|
+ System.out.println();
|
|
|
|
|
+ }
|
|
|
|
|
+}
|