diff --git a/.gitignore b/.gitignore
index d4c4269..43530c0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -20,6 +20,8 @@ target/
*.iml
*.ipr
/.mvn/
+.mvn
+forest.iml
### NetBeans ###
/nbproject/private/
diff --git a/.mvn/wrapper/maven-wrapper.jar b/.mvn/wrapper/maven-wrapper.jar
deleted file mode 100644
index 0d5e649..0000000
Binary files a/.mvn/wrapper/maven-wrapper.jar and /dev/null differ
diff --git a/docker/dev/forest.sql b/docker/dev/forest.sql
index 59ac599..ff72ce3 100644
--- a/docker/dev/forest.sql
+++ b/docker/dev/forest.sql
@@ -587,22 +587,27 @@ insert into forest.forest_user (id, account, password, nickname, real_name, sex,
values (2, 'testUser', '8ce2dd866238958ac4f07870766813cdaa39a9b83a8c75e26aa50f23', 'testUser', 'testUser', '0', '0',
null, 'testUser@rymcu.com',
null, '0', '2021-01-25 18:21:51', '2021-01-25 18:21:54', '2021-01-25 18:21:54', null);
+INSERT INTO `forest`.`forest_user` (`id`, `account`, `password`, `nickname`, `real_name`, `sex`, `avatar_type`,
+ `avatar_url`, `email`, `phone`, `status`, `created_time`, `updated_time`,
+ `last_login_time`, `signature`, `last_online_time`, `bg_img_url`)
+VALUES (65001, 'testUser1', '8ce2dd866238958ac4f07870766813cdaa39a9b83a8c75e26aa50f23', 'testUser', 'testUser1', '0',
+ '0', NULL, 'testUser@rymcu.com', NULL, '0', '2021-01-25 18:21:51', '2021-01-25 18:21:54', '2021-01-25 18:21:54',
+ NULL, NULL, NULL);
insert into forest.forest_user_role (id_user, id_role, created_time)
values (1, 1, '2021-01-25 18:22:12');
create table forest_file
(
- id int unsigned auto_increment comment 'id'
- primary key,
+ id int unsigned auto_increment comment 'id' primary key,
md5_value varchar(40) not null comment '文件md5值',
file_path varchar(255) not null comment '文件上传路径',
file_url varchar(255) not null comment '网络访问路径',
- created_time datetime null comment '创建时间',
- updated_time datetime null comment '更新时间',
- created_by int null comment '创建人',
- file_size int null comment '文件大小',
- file_type varchar(10) null comment '文件类型'
+ created_time datetime null comment '创建时间',
+ updated_time datetime null comment '更新时间',
+ created_by int null comment '创建人',
+ file_size int null comment '文件大小',
+ file_type varchar(10) null comment '文件类型'
) comment '文件上传记录表' collate = utf8mb4_unicode_ci;
create index index_md5_value_created_by
@@ -835,3 +840,9 @@ VALUES (2, 1, '100000002', 1207980.00000000, 2, '2020-11-26 21:37:18', '1');
INSERT INTO forest.forest_bank_account (id, id_bank, bank_account, account_balance, account_owner, created_time,
account_type)
VALUES (1, 1, '100000001', 997500000.00000000, 1, '2020-11-26 21:36:21', '1');
+INSERT INTO `forest`.`forest_bank_account` (`id`, `id_bank`, `bank_account`, `account_balance`, `account_owner`,
+ `created_time`, `account_type`)
+VALUES (3, 1, '100000061', 100.00000000, 65001, '2020-11-26 21:37:18', '0');
+INSERT INTO `forest`.`forest_bank_account` (`id`, `id_bank`, `bank_account`, `account_balance`, `account_owner`,
+ `created_time`, `account_type`)
+VALUES (4, 1, '100000063', 100.00000000, 65003, '2020-11-26 21:37:18', '0');
diff --git a/forest.iml b/forest.iml
deleted file mode 100644
index 1dc6832..0000000
--- a/forest.iml
+++ /dev/null
@@ -1,179 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/main/java/com/rymcu/forest/handler/CommentHandler.java b/src/main/java/com/rymcu/forest/handler/CommentHandler.java
index a558dd1..1ad1661 100644
--- a/src/main/java/com/rymcu/forest/handler/CommentHandler.java
+++ b/src/main/java/com/rymcu/forest/handler/CommentHandler.java
@@ -34,7 +34,7 @@ public class CommentHandler {
public void processCommentCreatedEvent(CommentEvent commentEvent) throws InterruptedException {
log.info(String.format("开始执行评论发布事件:[%s]", JSON.toJSONString(commentEvent)));
String commentContent = commentEvent.getContent();
- Integer length = commentContent.length();
+ int length = commentContent.length();
if (length > MAX_PREVIEW) {
length = 200;
}
diff --git a/src/main/java/com/rymcu/forest/service/ArticleThumbsUpService.java b/src/main/java/com/rymcu/forest/service/ArticleThumbsUpService.java
index 6185201..0edca81 100644
--- a/src/main/java/com/rymcu/forest/service/ArticleThumbsUpService.java
+++ b/src/main/java/com/rymcu/forest/service/ArticleThumbsUpService.java
@@ -4,6 +4,8 @@ import com.rymcu.forest.core.service.Service;
import com.rymcu.forest.entity.ArticleThumbsUp;
/**
+ * 点赞
+ *
* @author ronger
*/
public interface ArticleThumbsUpService extends Service {
diff --git a/src/main/java/com/rymcu/forest/service/BankAccountService.java b/src/main/java/com/rymcu/forest/service/BankAccountService.java
index 171f1c7..46475cb 100644
--- a/src/main/java/com/rymcu/forest/service/BankAccountService.java
+++ b/src/main/java/com/rymcu/forest/service/BankAccountService.java
@@ -9,6 +9,8 @@ import com.rymcu.forest.entity.BankAccount;
import java.util.List;
/**
+ * 银行账户服务
+ *
* @author ronger
*/
public interface BankAccountService extends Service {
diff --git a/src/main/java/com/rymcu/forest/service/BankService.java b/src/main/java/com/rymcu/forest/service/BankService.java
index 59fd8bb..51df799 100644
--- a/src/main/java/com/rymcu/forest/service/BankService.java
+++ b/src/main/java/com/rymcu/forest/service/BankService.java
@@ -7,6 +7,8 @@ import com.rymcu.forest.entity.Bank;
import java.util.List;
/**
+ * 银行
+ *
* @author ronger
*/
public interface BankService extends Service {
diff --git a/src/main/java/com/rymcu/forest/service/NotificationService.java b/src/main/java/com/rymcu/forest/service/NotificationService.java
index cd517f9..90e3de0 100644
--- a/src/main/java/com/rymcu/forest/service/NotificationService.java
+++ b/src/main/java/com/rymcu/forest/service/NotificationService.java
@@ -63,7 +63,7 @@ public interface NotificationService extends Service {
*
* @return
*/
- Integer readAllNotification();
+ Integer readAllNotification(Long idUser);
/**
* 删除相关未读消息
diff --git a/src/main/java/com/rymcu/forest/service/impl/BankServiceImpl.java b/src/main/java/com/rymcu/forest/service/impl/BankServiceImpl.java
index 431a506..4040f34 100644
--- a/src/main/java/com/rymcu/forest/service/impl/BankServiceImpl.java
+++ b/src/main/java/com/rymcu/forest/service/impl/BankServiceImpl.java
@@ -11,6 +11,8 @@ import javax.annotation.Resource;
import java.util.List;
/**
+ * 银行
+ *
* @author ronger
*/
@Service
diff --git a/src/main/java/com/rymcu/forest/service/impl/NotificationServiceImpl.java b/src/main/java/com/rymcu/forest/service/impl/NotificationServiceImpl.java
index 2711ea2..f7edf90 100644
--- a/src/main/java/com/rymcu/forest/service/impl/NotificationServiceImpl.java
+++ b/src/main/java/com/rymcu/forest/service/impl/NotificationServiceImpl.java
@@ -73,8 +73,8 @@ public class NotificationServiceImpl extends AbstractService imple
}
@Override
- public Integer readAllNotification() {
- return notificationMapper.readAllNotification(Objects.requireNonNull(UserUtils.getCurrentUserByToken()).getIdUser());
+ public Integer readAllNotification(Long idUser) {
+ return notificationMapper.readAllNotification(idUser);
}
@Override
diff --git a/src/main/java/com/rymcu/forest/web/api/notification/NotificationController.java b/src/main/java/com/rymcu/forest/web/api/notification/NotificationController.java
index 349a15c..016685a 100644
--- a/src/main/java/com/rymcu/forest/web/api/notification/NotificationController.java
+++ b/src/main/java/com/rymcu/forest/web/api/notification/NotificationController.java
@@ -13,6 +13,7 @@ import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
+import java.util.Objects;
/**
* 消息通知
@@ -56,7 +57,8 @@ public class NotificationController {
@PutMapping("/read-all")
public GlobalResult readAll() {
- Integer result = notificationService.readAllNotification();
+ Long idUser = UserUtils.getCurrentUserByToken().getIdUser();
+ Integer result = notificationService.readAllNotification(idUser);
if (result == 0) {
return GlobalResultGenerator.genErrorResult("标记已读失败");
}
diff --git a/src/test/java/com/rymcu/forest/base/BaseServiceTest.java b/src/test/java/com/rymcu/forest/base/BaseServiceTest.java
new file mode 100644
index 0000000..c0163c9
--- /dev/null
+++ b/src/test/java/com/rymcu/forest/base/BaseServiceTest.java
@@ -0,0 +1,16 @@
+package com.rymcu.forest.base;
+
+import org.junit.jupiter.api.MethodOrderer;
+import org.junit.jupiter.api.TestMethodOrder;
+import org.junit.jupiter.api.extension.ExtendWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit.jupiter.SpringExtension;
+import org.springframework.transaction.annotation.Transactional;
+
+@SpringBootTest
+@ExtendWith(SpringExtension.class)
+@Transactional
+// 顺序执行单元测试
+@TestMethodOrder(MethodOrderer.Random.class)
+public class BaseServiceTest {
+}
diff --git a/src/test/java/com/rymcu/forest/service/ArticleServiceTest.java b/src/test/java/com/rymcu/forest/service/ArticleServiceTest.java
index 6d272ef..817763e 100644
--- a/src/test/java/com/rymcu/forest/service/ArticleServiceTest.java
+++ b/src/test/java/com/rymcu/forest/service/ArticleServiceTest.java
@@ -1,5 +1,6 @@
package com.rymcu.forest.service;
+import cn.hutool.core.collection.CollectionUtil;
import com.rymcu.forest.dto.ArticleDTO;
import com.rymcu.forest.dto.ArticleSearchDTO;
import com.rymcu.forest.dto.ArticleTagDTO;
@@ -18,7 +19,6 @@ import org.springframework.transaction.annotation.Transactional;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
-import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@@ -98,8 +98,8 @@ class ArticleServiceTest {
@BeforeEach
public void postArticle() throws UnsupportedEncodingException {
Long articleId = articleService.postArticle(testArticle, testUser);
- testArticle.setIdArticle(articleId);
assertNotNull(articleId);
+ testArticle.setIdArticle(articleId);
}
/**
@@ -111,8 +111,7 @@ class ArticleServiceTest {
void findArticles() {
// 无参数时返回参数不应为EmptyList
List articlesAll = articleService.findArticles(new ArticleSearchDTO());
- assertNotNull(articlesAll);
- assertNotEquals(Collections.emptyList(), articlesAll);
+ assertTrue(CollectionUtil.isNotEmpty(articlesAll));
// 测试条件查询是否含有目标数据
ArticleSearchDTO articleSearchDTO = new ArticleSearchDTO();
@@ -151,7 +150,7 @@ class ArticleServiceTest {
@Test
void findUserArticlesByIdUser() {
List userArticlesByIdUser = articleService.findUserArticlesByIdUser(testArticle.getArticleAuthorId());
- assertNotEquals(Collections.emptyList(), userArticlesByIdUser);
+ assertTrue(CollectionUtil.isNotEmpty(userArticlesByIdUser));
}
/**
diff --git a/src/test/java/com/rymcu/forest/service/ArticleThumbsUpServiceTest.java b/src/test/java/com/rymcu/forest/service/ArticleThumbsUpServiceTest.java
new file mode 100644
index 0000000..c57c95c
--- /dev/null
+++ b/src/test/java/com/rymcu/forest/service/ArticleThumbsUpServiceTest.java
@@ -0,0 +1,67 @@
+package com.rymcu.forest.service;
+
+import com.rymcu.forest.base.BaseServiceTest;
+import com.rymcu.forest.core.exception.BusinessException;
+import com.rymcu.forest.dto.ArticleDTO;
+import com.rymcu.forest.dto.ArticleSearchDTO;
+import com.rymcu.forest.entity.ArticleThumbsUp;
+import org.junit.jupiter.api.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import java.util.Date;
+import java.util.List;
+
+import static org.junit.jupiter.api.Assertions.*;
+
+/**
+ * 点赞文章测试
+ *
+ * @author 毛毛虫
+ */
+class ArticleThumbsUpServiceTest extends BaseServiceTest {
+
+ /**
+ * 测试用点赞实体
+ */
+ private final ArticleThumbsUp articleThumbsUp;
+
+ @Autowired
+ private ArticleThumbsUpService articleThumbsUpService;
+ @Autowired
+ private ArticleService articleService;
+
+ {
+ articleThumbsUp = new ArticleThumbsUp();
+ articleThumbsUp.setIdArticle(-1L);
+ articleThumbsUp.setThumbsUpTime(new Date());
+ articleThumbsUp.setIdUser(-1L);
+ }
+
+
+ /**
+ * 测试点赞不存在的文章
+ */
+ @Test
+ public void thumbsNotExistsArticle() {
+ assertThrows(BusinessException.class, () -> {
+ articleThumbsUpService.thumbsUp(articleThumbsUp);
+ });
+ }
+
+ /**
+ * 测试点赞存在的文章
+ */
+ @Test
+ public void thumbsExistsArticle2() {
+ assertDoesNotThrow(() -> {
+ ArticleSearchDTO articleSearchDTO = new ArticleSearchDTO();
+ articleSearchDTO.setTopicUri("news");
+ List articles = articleService.findArticles(articleSearchDTO);
+ articleThumbsUp.setIdArticle(articles.get(0).getIdArticle());
+ });
+
+ int i = articleThumbsUpService.thumbsUp(articleThumbsUp);
+ assertEquals(1, i);
+ }
+
+}
\ No newline at end of file
diff --git a/src/test/java/com/rymcu/forest/service/BankAccountServiceTest.java b/src/test/java/com/rymcu/forest/service/BankAccountServiceTest.java
new file mode 100644
index 0000000..536dc79
--- /dev/null
+++ b/src/test/java/com/rymcu/forest/service/BankAccountServiceTest.java
@@ -0,0 +1,67 @@
+package com.rymcu.forest.service;
+
+import com.rymcu.forest.base.BaseServiceTest;
+import com.rymcu.forest.dto.BankAccountDTO;
+import com.rymcu.forest.dto.BankAccountSearchDTO;
+import com.rymcu.forest.dto.TransactionRecordDTO;
+import com.rymcu.forest.entity.BankAccount;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.DisplayName;
+import org.junit.jupiter.api.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import java.util.List;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+public class BankAccountServiceTest extends BaseServiceTest {
+
+ /**
+ * 待查询银行账户列表
+ */
+ private final BankAccountSearchDTO bankAccountSearchDTO;
+ private final Long idUser = 65001L;
+
+ @Autowired
+ private ArticleThumbsUpService articleThumbsUpService;
+ @Autowired
+ private BankAccountService bankAccountService;
+
+ {
+ bankAccountSearchDTO = new BankAccountSearchDTO();
+
+ }
+
+ @Test
+ @BeforeEach
+ @DisplayName("创建钱包账号")
+ public void createBankAccount() {
+
+ BankAccount bankAccount = bankAccountService.createBankAccount(idUser);
+ assertEquals(idUser, bankAccount.getAccountOwner());
+ }
+
+ @Test
+ @DisplayName("测试查询银行账户列表")
+ public void findBankAccounts() {
+ List bankAccounts = bankAccountService.findBankAccounts(bankAccountSearchDTO);
+ assertEquals(3, bankAccounts.size());
+ }
+
+ @Test
+ @DisplayName("测试查询银行账户")
+ public void findBankAccountByIdUser() {
+ BankAccountDTO bankAccountByIdUser = bankAccountService.findBankAccountByIdUser(idUser);
+ assertEquals(idUser.intValue(), bankAccountByIdUser.getAccountOwner());
+
+
+ }
+
+ @Test
+ @DisplayName("根据时间查询账号交易记录")
+ public void findUserTransactionRecords() {
+ List userTransactionRecords = bankAccountService.findUserTransactionRecords(idUser.toString(), "", "");
+ assertTrue(userTransactionRecords.isEmpty());
+ }
+}
\ No newline at end of file
diff --git a/src/test/java/com/rymcu/forest/service/BankServiceTest.java b/src/test/java/com/rymcu/forest/service/BankServiceTest.java
new file mode 100644
index 0000000..88fa46e
--- /dev/null
+++ b/src/test/java/com/rymcu/forest/service/BankServiceTest.java
@@ -0,0 +1,27 @@
+package com.rymcu.forest.service;
+
+import com.rymcu.forest.base.BaseServiceTest;
+import com.rymcu.forest.dto.BankDTO;
+import org.junit.jupiter.api.DisplayName;
+import org.junit.jupiter.api.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import java.util.List;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+public class BankServiceTest extends BaseServiceTest {
+
+
+ @Autowired
+ private BankService bankService;
+
+ @Test
+ @DisplayName("测试查询银行列表")
+ public void findBanks() {
+ List banks = bankService.findBanks();
+ assertEquals(2L, banks.size());
+ }
+
+
+}
\ No newline at end of file
diff --git a/src/test/java/com/rymcu/forest/service/CommentServiceTest.java b/src/test/java/com/rymcu/forest/service/CommentServiceTest.java
new file mode 100644
index 0000000..027671a
--- /dev/null
+++ b/src/test/java/com/rymcu/forest/service/CommentServiceTest.java
@@ -0,0 +1,154 @@
+package com.rymcu.forest.service;
+
+import com.rymcu.forest.base.BaseServiceTest;
+import com.rymcu.forest.core.exception.ContentNotExistException;
+import com.rymcu.forest.dto.ArticleDTO;
+import com.rymcu.forest.dto.ArticleTagDTO;
+import com.rymcu.forest.dto.Author;
+import com.rymcu.forest.dto.CommentDTO;
+import com.rymcu.forest.entity.Comment;
+import com.rymcu.forest.entity.User;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.DisplayName;
+import org.junit.jupiter.api.Test;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.mock.web.MockHttpServletRequest;
+
+import javax.servlet.http.HttpServletRequest;
+import java.io.UnsupportedEncodingException;
+import java.util.ArrayList;
+import java.util.List;
+
+import static org.junit.jupiter.api.Assertions.*;
+
+class CommentServiceTest extends BaseServiceTest {
+
+
+ /**
+ * 模拟request请求参数
+ */
+ private MockHttpServletRequest request;
+ /**
+ * 测试用的Article数据,用于该单元测试的一系列操作
+ */
+ private final ArticleDTO testArticle;
+ /**
+ * 与Article相关联的测试User数据(建表时提前放入)
+ */
+ private final User testUser = new User();
+ @Autowired
+ private CommentService commentService;
+ @Autowired
+ private ArticleService articleService;
+
+ {
+ request = new MockHttpServletRequest();
+ request.setCharacterEncoding("UTF-8");
+ // 构建数据之间的关联结构
+ Author testAuthor = Author.builder()
+ .idUser(2L)
+ .userArticleCount("0")
+ .userAccount("testUser")
+ .userNickname("testUser")
+ .userAvatarURL(null)
+ .build();
+ BeanUtils.copyProperties(testAuthor, testUser);
+
+ ArticleTagDTO tagDTO = ArticleTagDTO.builder()
+ .tagTitle("Test")
+ .tagDescription("Test")
+ .idTag(111)
+ .tagAuthorId(testUser.getIdUser())
+ .build();
+
+ List tags = new ArrayList<>();
+ tags.add(tagDTO);
+
+ testArticle = ArticleDTO.builder()
+ .articleAuthor(testAuthor)
+ .articleAuthorId(testAuthor.getIdUser())
+ .articleContent("Test")
+ .articleLink("Test")
+ .articlePerfect("0")
+ .articlePermalink("Test")
+ .articleAuthorName(testAuthor.getUserNickname())
+ .articleCommentCount(0)
+ .articleStatus("0")
+ .articleTags("Test")
+ .articleContentHtml("Test
")
+ .articleTitle("Test")
+ .articleType("0")
+ .articlePreviewContent("Test")
+ .articleSponsorCount(12)
+ .articlePermalink("Test")
+ .articleViewCount(0)
+ .tags(tags)
+ .build();
+ }
+
+ @BeforeEach
+ void setUp() throws UnsupportedEncodingException {
+ Long articleId = articleService.postArticle(testArticle, testUser);
+ assertNotNull(articleId);
+ testArticle.setIdArticle(articleId);
+ }
+
+
+ @Test
+ @DisplayName("获取评论")
+ void getArticleComments() {
+ Integer idArticle = testArticle.getIdArticle().intValue();
+ List articleComments = commentService.getArticleComments(idArticle);
+ assertEquals(0, articleComments.size());
+ }
+
+ @Test
+ @DisplayName("评论")
+ void postComment() {
+ Comment comment = new Comment();
+
+ // 文章id为null
+ assertThrows(IllegalArgumentException.class,()->{
+ commentService.postComment(comment,request);
+ });
+
+ comment.setCommentArticleId(-2L);
+ // 用户为空
+ assertThrows(IllegalArgumentException.class,()->{
+ commentService.postComment(comment,request);
+ });
+
+ comment.setCommentAuthorId(2L);
+ // 回帖内容为空
+ assertThrows(IllegalArgumentException.class,()->{
+ commentService.postComment(comment,request);
+ });
+
+ comment.setCommentContent("评论内容");
+ // 文章不存在
+ assertThrows(ContentNotExistException.class,()->{
+ commentService.postComment(comment,request);
+ });
+
+ comment.setCommentArticleId(testArticle.getIdArticle());
+ Comment comment1 = commentService.postComment(comment, request);
+ // 评论成功
+ assertEquals(comment.getCommentContent(), comment1.getCommentContent());
+
+ //测试评论数量
+ List articleComments = commentService.getArticleComments(testArticle.getIdArticle().intValue());
+ assertEquals(1, articleComments.size());
+
+ List findComments = commentService.findComments();
+ assertEquals(1, findComments.size());
+ }
+
+ @Test
+ @DisplayName("获取评论列表数据")
+ void findComments() {
+ Integer idArticle = testArticle.getIdArticle().intValue();
+ List articleComments = commentService.findComments();
+ assertEquals(0, articleComments.size());
+ }
+}
\ No newline at end of file
diff --git a/src/test/java/com/rymcu/forest/service/CurrencyRuleServiceTest.java b/src/test/java/com/rymcu/forest/service/CurrencyRuleServiceTest.java
new file mode 100644
index 0000000..1a6c2e9
--- /dev/null
+++ b/src/test/java/com/rymcu/forest/service/CurrencyRuleServiceTest.java
@@ -0,0 +1,23 @@
+package com.rymcu.forest.service;
+
+import com.rymcu.forest.base.BaseServiceTest;
+import com.rymcu.forest.entity.CurrencyRule;
+import org.junit.jupiter.api.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import java.util.List;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+class CurrencyRuleServiceTest extends BaseServiceTest {
+
+ @Autowired
+ private CurrencyRuleService currencyRuleService;
+
+ @Test
+ void currencyService() {
+ List all = currencyRuleService.findAll();
+ assertEquals(0, all.size());
+ }
+
+}
\ No newline at end of file
diff --git a/src/test/java/com/rymcu/forest/service/DashboardServiceTest.java b/src/test/java/com/rymcu/forest/service/DashboardServiceTest.java
new file mode 100644
index 0000000..3e6f43b
--- /dev/null
+++ b/src/test/java/com/rymcu/forest/service/DashboardServiceTest.java
@@ -0,0 +1,70 @@
+package com.rymcu.forest.service;
+
+import com.rymcu.forest.base.BaseServiceTest;
+import com.rymcu.forest.dto.ArticleDTO;
+import com.rymcu.forest.dto.BankAccountDTO;
+import com.rymcu.forest.dto.UserInfoDTO;
+import com.rymcu.forest.dto.admin.Dashboard;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.DisplayName;
+import org.junit.jupiter.api.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import java.util.List;
+import java.util.Map;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+class DashboardServiceTest extends BaseServiceTest {
+
+ @Autowired
+ private DashboardService dashboardService;
+
+ @BeforeEach
+ void setUp() {
+ }
+
+ @Test
+ @DisplayName("统计系统数据")
+ void dashboard() {
+ Dashboard result = dashboardService.dashboard();
+ assertEquals(1, result.getCountArticleNum());
+ }
+
+ @Test
+ @DisplayName("统计最近三十天数据")
+ void lastThirtyDaysData() {
+ Map result = dashboardService.lastThirtyDaysData();
+ assertEquals(5, result.size());
+ assertEquals(30, ((List) result.get("visits")).size());
+ }
+
+ @Test
+ @DisplayName("获取历史数据")
+ void history() {
+ Map result = dashboardService.history();
+ assertEquals(5, result.size());
+ assertEquals(12, ((List) result.get("visits")).size());
+ }
+
+ @Test
+ @DisplayName("获取新增用户列表")
+ void newUsers() {
+ List result = dashboardService.newUsers();
+ assertEquals(0L, result.size());
+ }
+
+ @Test
+ @DisplayName("获取新增银行账号列表")
+ void newBankAccounts() {
+ List result = dashboardService.newBankAccounts();
+ assertEquals(0L, result.size());
+ }
+
+ @Test
+ @DisplayName("获取新增文章列表")
+ void newArticles() {
+ List result = dashboardService.newArticles();
+ assertEquals(0L, result.size());
+ }
+}
\ No newline at end of file
diff --git a/src/test/java/com/rymcu/forest/service/FollowServiceTest.java b/src/test/java/com/rymcu/forest/service/FollowServiceTest.java
new file mode 100644
index 0000000..15850a0
--- /dev/null
+++ b/src/test/java/com/rymcu/forest/service/FollowServiceTest.java
@@ -0,0 +1,79 @@
+package com.rymcu.forest.service;
+
+import com.rymcu.forest.base.BaseServiceTest;
+import com.rymcu.forest.dto.UserDTO;
+import com.rymcu.forest.entity.Follow;
+import org.junit.jupiter.api.DisplayName;
+import org.junit.jupiter.api.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import java.util.List;
+
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+class FollowServiceTest extends BaseServiceTest {
+ private final Long followingId = 1L;
+ private final Long idUser = 2L;
+ private final String followingType = "0";
+
+ private final Follow follow;
+ @Autowired
+ private FollowService followService;
+
+ {
+ follow = new Follow();
+ follow.setFollowerId(idUser);
+ follow.setFollowingType(followingType);
+ follow.setFollowingId(followingId);
+
+ }
+
+ @Test
+ void isFollow() {
+ Boolean b = followService.isFollow(followingId.intValue(), followingType, idUser);
+ assertFalse(b);
+
+ }
+
+ @Test
+ @DisplayName("关注操作")
+ void follow() {
+
+ Boolean b = followService.follow(follow, "nickname");
+ assertTrue(b);
+
+ }
+
+ @Test
+ @DisplayName("取消关注操作")
+ void cancelFollow() {
+ Boolean b = followService.cancelFollow(follow);
+ assertTrue(b);
+ }
+
+ @Test
+ @DisplayName("获取关注用户者数据")
+ void findByFollowingId() {
+ List list = followService.findByFollowingId(followingType, followingId);
+ assertTrue(list.isEmpty());
+ }
+
+ @Test
+ @DisplayName("查询用户粉丝")
+ void findUserFollowersByUser() {
+ UserDTO userDTO = new UserDTO();
+ userDTO.setIdUser(idUser);
+ List list = followService.findUserFollowersByUser(userDTO);
+ assertTrue(list.isEmpty());
+ }
+
+ @Test
+ @DisplayName("查询用户关注用户")
+ void findUserFollowingsByUser() {
+ UserDTO userDTO = new UserDTO();
+ userDTO.setIdUser(idUser);
+ List list = followService.findUserFollowingsByUser(userDTO);
+ assertTrue(list.isEmpty());
+ }
+}
diff --git a/src/test/java/com/rymcu/forest/service/ForestFileServiceTest.java b/src/test/java/com/rymcu/forest/service/ForestFileServiceTest.java
new file mode 100644
index 0000000..db87f60
--- /dev/null
+++ b/src/test/java/com/rymcu/forest/service/ForestFileServiceTest.java
@@ -0,0 +1,41 @@
+package com.rymcu.forest.service;
+
+import com.rymcu.forest.base.BaseServiceTest;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.DisplayName;
+import org.junit.jupiter.api.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+class ForestFileServiceTest extends BaseServiceTest {
+
+ private final String fileUrl = "localhost/upload/file/123.jpg";
+ private final String filePath = "upload/file/123.jpg";
+ private final String md5Value = "md5Value";
+ private final long createdBy = 1L;
+ private final long fileSize = 1024L;
+ private final String fileType = "jpg";
+
+ @Autowired
+ private ForestFileService forestFileService;
+
+ @BeforeEach
+ void setUp() {
+ forestFileService.insertForestFile(fileUrl, filePath, md5Value, createdBy, fileSize, fileType);
+ }
+
+ @Test
+ @DisplayName("通过md5获取文件访问链接")
+ void getFileUrlByMd5() {
+ String fileUrlByMd5 = forestFileService.getFileUrlByMd5(md5Value, createdBy, fileType);
+ assertEquals(fileUrl, fileUrlByMd5);
+ }
+
+ @Test
+ @DisplayName("插入文件对象")
+ void insertForestFile() {
+ int i = forestFileService.insertForestFile(fileUrl, filePath, md5Value, createdBy, fileSize, fileType);
+ assertEquals(1, i);
+ }
+}
\ No newline at end of file
diff --git a/src/test/java/com/rymcu/forest/service/JavaMailServiceTest.java b/src/test/java/com/rymcu/forest/service/JavaMailServiceTest.java
new file mode 100644
index 0000000..ce358ae
--- /dev/null
+++ b/src/test/java/com/rymcu/forest/service/JavaMailServiceTest.java
@@ -0,0 +1,39 @@
+package com.rymcu.forest.service;
+
+import com.rymcu.forest.base.BaseServiceTest;
+import com.rymcu.forest.dto.NotificationDTO;
+import org.junit.jupiter.api.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.mail.MailParseException;
+
+import javax.mail.MessagingException;
+import javax.mail.internet.AddressException;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+
+/**
+ * javaMail测试
+ */
+class JavaMailServiceTest extends BaseServiceTest {
+
+ private static final String REALITY_EMAIL = "1421374934@qq.com";
+ @Autowired
+ private JavaMailService javaMailService;
+
+ @Test
+ void sendEmailCode() throws MessagingException {
+ assertEquals(1, javaMailService.sendEmailCode(REALITY_EMAIL));
+ }
+
+ @Test
+ void sendForgetPasswordEmail() throws MessagingException {
+ assertEquals(1, javaMailService.sendForgetPasswordEmail(REALITY_EMAIL));
+ }
+
+ @Test
+ void sendNotification() throws MessagingException {
+ assertEquals(0, javaMailService.sendNotification(new NotificationDTO()));
+
+ }
+}
diff --git a/src/test/java/com/rymcu/forest/service/LoginRecordServiceTest.java b/src/test/java/com/rymcu/forest/service/LoginRecordServiceTest.java
new file mode 100644
index 0000000..c560b72
--- /dev/null
+++ b/src/test/java/com/rymcu/forest/service/LoginRecordServiceTest.java
@@ -0,0 +1,59 @@
+package com.rymcu.forest.service;
+
+import com.rymcu.forest.base.BaseServiceTest;
+import com.rymcu.forest.entity.LoginRecord;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.DisplayName;
+import org.junit.jupiter.api.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.mock.web.MockHttpServletRequest;
+import org.springframework.web.context.request.RequestContextHolder;
+import org.springframework.web.context.request.ServletRequestAttributes;
+
+import java.util.List;
+
+import static org.junit.jupiter.api.Assertions.*;
+
+class LoginRecordServiceTest extends BaseServiceTest {
+
+ @Autowired
+ private LoginRecordService loginRecordService;
+
+ @BeforeEach
+ void setUp() {
+ //设置user-agent
+ ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
+ if (attributes == null) {
+ return;
+ }
+ MockHttpServletRequest request = (MockHttpServletRequest) attributes.getRequest();
+ request.addHeader("user-agent", "Windows 10 or Windows Server 2016\", \"windows nt 10\\\\.0\", \"windows nt (10\\\\.0)\" ");
+ }
+
+ @Test
+ @DisplayName("保存登录记录")
+ void saveLoginRecord() {
+ LoginRecord loginRecord = loginRecordService.saveLoginRecord(1L);
+ assertNotNull(loginRecord);
+ }
+
+ @Test
+ @DisplayName("获取用户登录记录")
+ void findLoginRecordByIdUser() {
+ List loginRecordByIdUser = loginRecordService.findLoginRecordByIdUser(1);
+ assertTrue(loginRecordByIdUser.isEmpty());
+
+ }
+
+
+ @Test
+ @DisplayName("测试全部")
+ void doAll() {
+ LoginRecord loginRecord = loginRecordService.saveLoginRecord(1L);
+ assertNotNull(loginRecord);
+
+ List loginRecordByIdUser = loginRecordService.findLoginRecordByIdUser(1);
+ assertFalse(loginRecordByIdUser.isEmpty());
+
+ }
+}
\ No newline at end of file
diff --git a/src/test/java/com/rymcu/forest/service/NotificationServiceTest.java b/src/test/java/com/rymcu/forest/service/NotificationServiceTest.java
new file mode 100644
index 0000000..772c2ae
--- /dev/null
+++ b/src/test/java/com/rymcu/forest/service/NotificationServiceTest.java
@@ -0,0 +1,109 @@
+package com.rymcu.forest.service;
+
+import com.rymcu.forest.base.BaseServiceTest;
+import com.rymcu.forest.core.constant.NotificationConstant;
+import com.rymcu.forest.dto.NotificationDTO;
+import com.rymcu.forest.entity.Notification;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.DisplayName;
+import org.junit.jupiter.api.Order;
+import org.junit.jupiter.api.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import java.util.List;
+
+import static org.junit.jupiter.api.Assertions.*;
+
+/**
+ * 消息通知接口测试
+ */
+@Order(1)
+class NotificationServiceTest extends BaseServiceTest {
+ private final Long idUser = 2L;
+ private final Long dataId = 1L;
+ private final String dataSummary = "nickname 关注了你!";
+ @Autowired
+ private NotificationService notificationService;
+
+ @BeforeEach
+ void setUp() {
+ save();
+ }
+
+ @Test
+ @DisplayName("获取未读消息数据")
+ void findUnreadNotifications() {
+ List unreadNotifications = notificationService.findUnreadNotifications(idUser);
+ assertFalse(unreadNotifications.isEmpty());
+ }
+
+ @Test
+ @DisplayName("获取消息数据")
+ void findNotifications() {
+ List notifications = notificationService.findNotifications(idUser);
+ assertNotNull(notifications);
+ }
+
+ @Test
+ @DisplayName("获取消息数据")
+ void findNotification() {
+ Notification notification = notificationService.findNotification(idUser, dataId, NotificationConstant.Follow);
+ assertNotNull(notification);
+ assertEquals(idUser, notification.getIdUser());
+ assertEquals(dataSummary, notification.getDataSummary());
+
+ Notification notification2 = notificationService.findNotification(0L, dataId, NotificationConstant.Follow);
+ assertNull(notification2);
+ }
+
+ @DisplayName("创建系统通知")
+ void save() {
+ List notifications = notificationService.findUnreadNotifications(idUser);
+ int size = notifications.size();
+ Integer integer = notificationService.save(idUser, dataId, NotificationConstant.Follow, dataSummary);
+ assertEquals(1, integer);
+ notifications = notificationService.findUnreadNotifications(idUser);
+ assertEquals(size + 1, notifications.size());
+ }
+
+ @Test
+ @DisplayName("标记消息已读")
+ void readNotification() {
+ List notifications = notificationService.findUnreadNotifications(idUser);
+ int size = notifications.size();
+// Integer integer = notificationService.deleteUnreadNotification(idUser, NotificationConstant.Follow);
+// assertEquals(1, integer);
+
+ Integer integer = notificationService.readNotification(notifications.get(0).getIdNotification(), idUser);
+ assertNotEquals(0, integer);
+
+ notifications = notificationService.findUnreadNotifications(idUser);
+ assertEquals(size - 1, notifications.size());
+ }
+
+ /**
+ * 测试太麻烦测试不了,
+ * 测试还得模拟向redis存入数据不建议测试
+ */
+ @Test
+ @DisplayName("标记所有消息已读")
+ void readAllNotification() {
+ assertNotEquals(0, notificationService.readAllNotification(idUser));
+ }
+
+ @Test
+ @DisplayName("删除相关未读消息")
+ void deleteUnreadNotification() {
+ List notifications = notificationService.findUnreadNotifications(idUser);
+ int size = notifications.size();
+ System.out.println(size);
+ Integer integer = notificationService.deleteUnreadNotification(dataId, NotificationConstant.Follow);
+ assertNotEquals(0, integer);
+
+ integer = notificationService.deleteUnreadNotification(dataId, NotificationConstant.Follow);
+ assertEquals(0, integer);
+
+ notifications = notificationService.findUnreadNotifications(idUser);
+ assertEquals(0, notifications.size());
+ }
+}
diff --git a/src/test/java/com/rymcu/forest/service/OpenDataServiceTest.java b/src/test/java/com/rymcu/forest/service/OpenDataServiceTest.java
new file mode 100644
index 0000000..7324b4e
--- /dev/null
+++ b/src/test/java/com/rymcu/forest/service/OpenDataServiceTest.java
@@ -0,0 +1,42 @@
+package com.rymcu.forest.service;
+
+import com.rymcu.forest.base.BaseServiceTest;
+import com.rymcu.forest.dto.admin.Dashboard;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.DisplayName;
+import org.junit.jupiter.api.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import java.util.Map;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+
+/**
+ * 开发数据测试
+ */
+class OpenDataServiceTest extends BaseServiceTest {
+
+ @Autowired
+ private OpenDataService openDataService;
+
+ @BeforeEach
+ void setUp() {
+ }
+
+ @Test
+ @DisplayName("获取最近30天开放数据")
+ void lastThirtyDaysData() {
+ Map map = openDataService.lastThirtyDaysData();
+ assertNotNull(map);
+ assertEquals(3, map.size());
+ }
+
+ @Test
+ @DisplayName("获取统计数据")
+ void dashboard() {
+ Dashboard dashboard = openDataService.dashboard();
+ assertEquals(3, dashboard.getCountUserNum());
+ assertEquals(1, dashboard.getCountArticleNum());
+ }
+}
\ No newline at end of file
diff --git a/src/test/java/com/rymcu/forest/service/PermissionServiceTest.java b/src/test/java/com/rymcu/forest/service/PermissionServiceTest.java
new file mode 100644
index 0000000..6ffb446
--- /dev/null
+++ b/src/test/java/com/rymcu/forest/service/PermissionServiceTest.java
@@ -0,0 +1,34 @@
+package com.rymcu.forest.service;
+
+import com.rymcu.forest.base.BaseServiceTest;
+import com.rymcu.forest.entity.User;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.DisplayName;
+import org.junit.jupiter.api.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.jdbc.BadSqlGrammarException;
+
+import static org.junit.jupiter.api.Assertions.assertThrows;
+
+/**
+ * 权限测试
+ */
+class PermissionServiceTest extends BaseServiceTest {
+
+ @Autowired
+ private PermissionService permissionService;
+
+ @BeforeEach
+ void setUp() {
+ }
+
+ @Test
+ @DisplayName("获取用户权限")
+ void selectPermissionByUser() {
+ User user = new User();
+ user.setIdUser(1L);
+ assertThrows(BadSqlGrammarException.class, () -> {
+ permissionService.selectPermissionByUser(user);
+ });
+ }
+}
\ No newline at end of file
diff --git a/src/test/java/com/rymcu/forest/service/PortfolioServiceTest.java b/src/test/java/com/rymcu/forest/service/PortfolioServiceTest.java
new file mode 100644
index 0000000..b10f7b5
--- /dev/null
+++ b/src/test/java/com/rymcu/forest/service/PortfolioServiceTest.java
@@ -0,0 +1,254 @@
+package com.rymcu.forest.service;
+
+import com.github.pagehelper.PageInfo;
+import com.rymcu.forest.base.BaseServiceTest;
+import com.rymcu.forest.core.exception.BusinessException;
+import com.rymcu.forest.core.exception.ServiceException;
+import com.rymcu.forest.core.exception.UltraViresException;
+import com.rymcu.forest.dto.*;
+import com.rymcu.forest.entity.Portfolio;
+import com.rymcu.forest.entity.User;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.DisplayName;
+import org.junit.jupiter.api.Test;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import java.io.UnsupportedEncodingException;
+import java.util.ArrayList;
+import java.util.List;
+
+import static org.junit.jupiter.api.Assertions.*;
+
+/**
+ * 作品集测试
+ */
+class PortfolioServiceTest extends BaseServiceTest {
+
+ /**
+ * 测试用的Article数据,用于该单元测试的一系列操作
+ */
+ private final ArticleDTO testArticle;
+ private final UserDTO userDTO = new UserDTO();
+ private final Portfolio portfolio = new Portfolio();
+ /**
+ * 与Article相关联的测试User数据(建表时提前放入)
+ */
+ private final User testUser = new User();
+ PortfolioArticleDTO portfolioArticleDTO = new PortfolioArticleDTO();
+ ;
+ @Autowired
+ private PortfolioService portfolioService;
+ @Autowired
+ private ArticleService articleService;
+
+ {
+ userDTO.setIdUser(2L);
+
+ portfolio.setPortfolioDescriptionHtml("test");
+ portfolio.setPortfolioDescription("test");
+ portfolio.setPortfolioAuthorId(userDTO.getIdUser());
+ portfolio.setPortfolioTitle("test");
+
+ // 构建数据之间的关联结构
+ Author testAuthor = Author.builder()
+ .idUser(2L)
+ .userArticleCount("0")
+ .userAccount("testUser")
+ .userNickname("testUser")
+ .userAvatarURL(null)
+ .build();
+ BeanUtils.copyProperties(testAuthor, testUser);
+
+ ArticleTagDTO tagDTO = ArticleTagDTO.builder()
+ .tagTitle("Test")
+ .tagDescription("Test")
+ .idTag(111)
+ .tagAuthorId(testUser.getIdUser())
+ .build();
+
+ List tags = new ArrayList<>();
+ tags.add(tagDTO);
+
+ testArticle = ArticleDTO.builder()
+ .articleAuthor(testAuthor)
+ .articleAuthorId(testAuthor.getIdUser())
+ .articleContent("Test")
+ .articleLink("Test")
+ .articlePerfect("0")
+ .articlePermalink("Test")
+ .articleAuthorName(testAuthor.getUserNickname())
+ .articleCommentCount(0)
+ .articleStatus("0")
+ .articleTags("Test")
+ .articleContentHtml("Test
")
+ .articleTitle("Test")
+ .articleType("0")
+ .articlePreviewContent("Test")
+ .articleSponsorCount(12)
+ .articlePermalink("Test")
+ .articleViewCount(0)
+ .tags(tags)
+ .build();
+ }
+
+ @BeforeEach
+ void setUp() throws UnsupportedEncodingException {
+ Long articleId = articleService.postArticle(testArticle, testUser);
+ assertNotNull(articleId);
+ testArticle.setIdArticle(articleId);
+ }
+
+ @Test
+ @DisplayName("查询用户作品集")
+ void findUserPortfoliosByUser() {
+ List userPortfoliosByUser = portfolioService.findUserPortfoliosByUser(userDTO);
+ assertTrue(userPortfoliosByUser.isEmpty());
+ }
+
+ @Test
+ @DisplayName("查询作品集")
+ void findPortfolioDTOById() {
+ PortfolioDTO portfolioDTO = portfolioService.findPortfolioDTOById(1L, null);
+ assertNull(portfolioDTO.getIdPortfolio());
+ }
+
+ @Test
+ @DisplayName("保持/更新作品集")
+ void postPortfolio() {
+ List userPortfoliosByUser = portfolioService.findUserPortfoliosByUser(userDTO);
+ assertTrue(userPortfoliosByUser.isEmpty());
+ portfolioService.postPortfolio(portfolio);
+
+ Portfolio portfolio1 = portfolioService.postPortfolio(portfolio);
+ assertNotNull(portfolio1.getIdPortfolio());
+ assertEquals(portfolio, portfolio1);
+
+ userPortfoliosByUser = portfolioService.findUserPortfoliosByUser(userDTO);
+ assertEquals(1, userPortfoliosByUser.size());
+
+ PortfolioDTO portfolioDTO = portfolioService.findPortfolioDTOById(portfolio1.getIdPortfolio(), null);
+ assertEquals(portfolio1.getPortfolioDescription(), portfolioDTO.getPortfolioDescription());
+
+
+ }
+
+ @Test
+ @DisplayName("查询作品集下未绑定文章")
+ void findUnbindArticles() {
+ assertThrows(
+ BusinessException.class, () -> portfolioService.findUnbindArticles(1, 10, "test", portfolio.getIdPortfolio(), userDTO.getIdUser())
+ );
+
+ Portfolio portfolio1 = portfolioService.postPortfolio(portfolio);
+
+ assertThrows(
+ UltraViresException.class, () -> portfolioService.findUnbindArticles(1, 10, "test", portfolio.getIdPortfolio(), 1L)
+ );
+
+ PageInfo articles = portfolioService.findUnbindArticles(1, 10, "test", portfolio.getIdPortfolio(), userDTO.getIdUser());
+ assertEquals(1L, articles.getTotal());
+ }
+
+ @Test
+ @DisplayName("绑定文章")
+ void bindArticle() {
+ portfolioService.postPortfolio(portfolio);
+
+ portfolioArticleDTO.setIdArticle(testArticle.getIdArticle());
+ portfolioArticleDTO.setIdPortfolio(portfolio.getIdPortfolio());
+ boolean b = portfolioService.bindArticle(portfolioArticleDTO);
+
+ assertTrue(b);
+
+ assertThrows(BusinessException.class, () -> portfolioService.bindArticle(portfolioArticleDTO));
+
+ }
+
+ @Test
+ @DisplayName("更新文章排序号")
+ void updateArticleSortNo() {
+ portfolioService.postPortfolio(portfolio);
+
+ assertThrows(ServiceException.class, () -> portfolioService.updateArticleSortNo(portfolioArticleDTO));
+ portfolioArticleDTO.setIdArticle(testArticle.getIdArticle());
+ portfolioArticleDTO.setIdPortfolio(portfolio.getIdPortfolio());
+ portfolioArticleDTO.setSortNo(10);
+
+ assertThrows(ServiceException.class, () -> portfolioService.updateArticleSortNo(portfolioArticleDTO));
+
+ portfolioService.bindArticle(portfolioArticleDTO);
+
+ boolean b = portfolioService.updateArticleSortNo(portfolioArticleDTO);
+ assertTrue(b);
+
+ portfolioService.updateArticleSortNo(portfolioArticleDTO);
+ assertTrue(b);
+ }
+
+ @Test
+ @DisplayName("取消绑定文章")
+ void unbindArticle() {
+ assertThrows(ServiceException.class, () -> portfolioService.unbindArticle(null, null));
+
+ portfolioService.postPortfolio(portfolio);
+
+ portfolioArticleDTO.setIdArticle(testArticle.getIdArticle());
+ portfolioArticleDTO.setIdPortfolio(portfolio.getIdPortfolio());
+ portfolioArticleDTO.setSortNo(10);
+ portfolioService.bindArticle(portfolioArticleDTO);
+
+ boolean b = portfolioService.unbindArticle(portfolio.getIdPortfolio(), portfolioArticleDTO.getIdArticle());
+ assertTrue(b);
+ }
+
+
+ @Test
+ @DisplayName("删除作品集")
+ void deletePortfolio() {
+ portfolioService.postPortfolio(portfolio);
+ assertThrows(IllegalArgumentException.class, () -> portfolioService.deletePortfolio(null, null, null));
+
+ assertThrows(NullPointerException.class, () -> portfolioService.deletePortfolio(portfolio.getIdPortfolio(), null, 3));
+
+
+ assertThrows(UltraViresException.class, () -> portfolioService.deletePortfolio(portfolio.getIdPortfolio(), 1L, 3));
+
+ boolean b = portfolioService.deletePortfolio(portfolio.getIdPortfolio(), userDTO.getIdUser(), 3);
+ assertTrue(b);
+
+ portfolio.setIdPortfolio(null);
+ portfolioService.postPortfolio(portfolio);
+ b = portfolioService.deletePortfolio(portfolio.getIdPortfolio(), userDTO.getIdUser(), 1);
+ assertTrue(b);
+
+ assertThrows(BusinessException.class, () -> portfolioService.deletePortfolio(portfolio.getIdPortfolio(), userDTO.getIdUser(), 1));
+
+ portfolio.setIdPortfolio(null);
+ portfolioService.postPortfolio(portfolio);
+
+ portfolioArticleDTO.setIdArticle(testArticle.getIdArticle());
+ portfolioArticleDTO.setIdPortfolio(portfolio.getIdPortfolio());
+ portfolioArticleDTO.setSortNo(10);
+ portfolioService.bindArticle(portfolioArticleDTO);
+
+ assertThrows(BusinessException.class, () -> portfolioService.deletePortfolio(portfolio.getIdPortfolio(), userDTO.getIdUser(), 1));
+
+ portfolioService.unbindArticle(portfolio.getIdPortfolio(), portfolioArticleDTO.getIdArticle());
+
+ portfolioService.deletePortfolio(portfolio.getIdPortfolio(), userDTO.getIdUser(), 1);
+ assertTrue(b);
+
+ }
+
+ @Test
+ @DisplayName("获取作品集列表数据")
+ void findPortfolios() {
+ List portfolios = portfolioService.findPortfolios();
+ assertTrue(portfolios.isEmpty());
+
+ portfolioService.postPortfolio(portfolio);
+ portfolios = portfolioService.findPortfolios();
+ assertFalse(portfolios.isEmpty());
+ }
+}
\ No newline at end of file
diff --git a/src/test/java/com/rymcu/forest/service/ProductServiceTest.java b/src/test/java/com/rymcu/forest/service/ProductServiceTest.java
new file mode 100644
index 0000000..eeecc87
--- /dev/null
+++ b/src/test/java/com/rymcu/forest/service/ProductServiceTest.java
@@ -0,0 +1,40 @@
+package com.rymcu.forest.service;
+
+import com.rymcu.forest.base.BaseServiceTest;
+import com.rymcu.forest.dto.ProductDTO;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.DisplayName;
+import org.junit.jupiter.api.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import java.util.List;
+
+import static org.junit.jupiter.api.Assertions.*;
+
+class ProductServiceTest extends BaseServiceTest {
+
+ @Autowired
+ private ProductService productService;
+
+ @BeforeEach
+ void setUp() {
+ }
+
+ @Test
+ @DisplayName("查询产品列表")
+ void findProducts() {
+ List products = productService.findProducts();
+ assertFalse(products.isEmpty());
+ }
+
+ @Test
+ @DisplayName("获取产品详情")
+ void findProductDTOById() {
+ ProductDTO productDTOById = productService.findProductDTOById(1, null);
+ assertNotNull(productDTOById);
+ ProductDTO productDTOById2 = productService.findProductDTOById(1, 1);
+
+ assertEquals(productDTOById.getProductTitle(), productDTOById2.getProductTitle());
+ assertNotEquals(productDTOById.getProductContent(), productDTOById2.getProductContent());
+ }
+}
\ No newline at end of file
diff --git a/src/test/java/com/rymcu/forest/service/RoleServiceTest.java b/src/test/java/com/rymcu/forest/service/RoleServiceTest.java
new file mode 100644
index 0000000..13f113a
--- /dev/null
+++ b/src/test/java/com/rymcu/forest/service/RoleServiceTest.java
@@ -0,0 +1,68 @@
+package com.rymcu.forest.service;
+
+import com.rymcu.forest.base.BaseServiceTest;
+import com.rymcu.forest.entity.Role;
+import com.rymcu.forest.entity.User;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.DisplayName;
+import org.junit.jupiter.api.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import java.util.List;
+
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+/**
+ * 角色service测试
+ */
+class RoleServiceTest extends BaseServiceTest {
+
+ @Autowired
+ private RoleService roleService;
+
+ @BeforeEach
+ void setUp() {
+ }
+
+ @Test
+ @DisplayName("查询用户角色")
+ void selectRoleByUser() {
+ User user = new User();
+ user.setIdUser(1L);
+ List roles = roleService.selectRoleByUser(user);
+ assertFalse(roles.isEmpty());
+
+ user.setIdUser(0L);
+ roleService.selectRoleByUser(user);
+ assertFalse(roles.isEmpty());
+ }
+
+ @Test
+ @DisplayName("查询用户角色")
+ void findByIdUser() {
+ List roles = roleService.findByIdUser(1L);
+ assertFalse(roles.isEmpty());
+
+ roles = roleService.findByIdUser(0L);
+ assertTrue(roles.isEmpty());
+ }
+
+ @Test
+ @DisplayName("更新角色状态")
+ void updateStatus() {
+ boolean b = roleService.updateStatus(1L, "1");
+ assertTrue(b);
+ }
+
+ @Test
+ @DisplayName("添加/更新角色")
+ void saveRole() {
+ Role role = new Role();
+ role.setName("test_role");
+ role.setStatus("0");
+ role.setWeights(1);
+ boolean b = roleService.saveRole(role);
+ assertTrue(b);
+ }
+}
\ No newline at end of file
diff --git a/src/test/java/com/rymcu/forest/service/SpecialDayServiceTest.java b/src/test/java/com/rymcu/forest/service/SpecialDayServiceTest.java
new file mode 100644
index 0000000..d2afb4b
--- /dev/null
+++ b/src/test/java/com/rymcu/forest/service/SpecialDayServiceTest.java
@@ -0,0 +1,11 @@
+package com.rymcu.forest.service;
+
+import com.rymcu.forest.base.BaseServiceTest;
+import org.junit.jupiter.api.BeforeEach;
+
+class SpecialDayServiceTest extends BaseServiceTest {
+
+ @BeforeEach
+ void setUp() {
+ }
+}
\ No newline at end of file
diff --git a/src/test/java/com/rymcu/forest/service/SponsorServiceTest.java b/src/test/java/com/rymcu/forest/service/SponsorServiceTest.java
new file mode 100644
index 0000000..73b8d6c
--- /dev/null
+++ b/src/test/java/com/rymcu/forest/service/SponsorServiceTest.java
@@ -0,0 +1,42 @@
+package com.rymcu.forest.service;
+
+import com.rymcu.forest.base.BaseServiceTest;
+import com.rymcu.forest.entity.Sponsor;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.DisplayName;
+import org.junit.jupiter.api.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.dao.DataIntegrityViolationException;
+
+import java.math.BigDecimal;
+
+import static org.junit.jupiter.api.Assertions.assertThrows;
+
+/**
+ * 赞赏test
+ */
+class SponsorServiceTest extends BaseServiceTest {
+
+ @Autowired
+ private SponsorService sponsorService;
+
+ @BeforeEach
+ void setUp() {
+ }
+
+ @Test
+ @DisplayName("赞赏")
+ void sponsorship() {
+ Sponsor sponsor = new Sponsor();
+ assertThrows(NullPointerException.class, () -> sponsorService.sponsorship(sponsor));
+ sponsor.setSponsor(1L);
+ sponsor.setSponsorshipMoney(BigDecimal.TEN);
+ sponsor.setDataType(200);
+ sponsor.setDataId(65001L);
+
+ assertThrows(DataIntegrityViolationException.class, () -> sponsorService.sponsorship(sponsor));
+
+ sponsor.setDataType(3);
+ sponsorService.sponsorship(sponsor);
+ }
+}
\ No newline at end of file
diff --git a/src/test/java/com/rymcu/forest/service/TagServiceTest.java b/src/test/java/com/rymcu/forest/service/TagServiceTest.java
new file mode 100644
index 0000000..cec45e6
--- /dev/null
+++ b/src/test/java/com/rymcu/forest/service/TagServiceTest.java
@@ -0,0 +1,145 @@
+package com.rymcu.forest.service;
+
+import com.rymcu.forest.base.BaseServiceTest;
+import com.rymcu.forest.core.exception.BusinessException;
+import com.rymcu.forest.dto.ArticleDTO;
+import com.rymcu.forest.dto.ArticleTagDTO;
+import com.rymcu.forest.dto.Author;
+import com.rymcu.forest.dto.LabelModel;
+import com.rymcu.forest.entity.Article;
+import com.rymcu.forest.entity.Tag;
+import com.rymcu.forest.entity.User;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.DisplayName;
+import org.junit.jupiter.api.Test;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import java.io.UnsupportedEncodingException;
+import java.util.ArrayList;
+import java.util.List;
+
+import static org.junit.jupiter.api.Assertions.*;
+
+/**
+ * 标签test
+ */
+class TagServiceTest extends BaseServiceTest {
+
+ /**
+ * 测试用的Article数据,用于该单元测试的一系列操作
+ */
+ private final ArticleDTO testArticle;
+ /**
+ * 与Article相关联的测试User数据(建表时提前放入)
+ */
+ private final User testUser = new User();
+ @Autowired
+ private TagService tagService;
+ @Autowired
+ private ArticleService articleService;
+
+ {
+ // 构建数据之间的关联结构
+ Author testAuthor = Author.builder()
+ .idUser(2L)
+ .userArticleCount("0")
+ .userAccount("testUser")
+ .userNickname("testUser")
+ .userAvatarURL(null)
+ .build();
+ BeanUtils.copyProperties(testAuthor, testUser);
+
+ ArticleTagDTO tagDTO = ArticleTagDTO.builder()
+ .tagTitle("Test")
+ .tagDescription("Test")
+ .idTag(111)
+ .tagAuthorId(testUser.getIdUser())
+ .build();
+
+ List tags = new ArrayList<>();
+ tags.add(tagDTO);
+
+ testArticle = ArticleDTO.builder()
+ .articleAuthor(testAuthor)
+ .articleAuthorId(testAuthor.getIdUser())
+ .articleContent("Test")
+ .articleLink("Test")
+ .articlePerfect("0")
+ .articlePermalink("Test")
+ .articleAuthorName(testAuthor.getUserNickname())
+ .articleCommentCount(0)
+ .articleStatus("0")
+ .articleTags("Test")
+ .articleContentHtml("Test
")
+ .articleTitle("Test")
+ .articleType("0")
+ .articlePreviewContent("Test")
+ .articleSponsorCount(12)
+ .articlePermalink("Test")
+ .articleViewCount(0)
+ .tags(tags)
+ .build();
+ }
+
+ @BeforeEach
+ void setUp() throws UnsupportedEncodingException {
+ Long articleId = articleService.postArticle(testArticle, testUser);
+ assertNotNull(articleId);
+ testArticle.setIdArticle(articleId);
+ }
+
+ @Test
+ @DisplayName("保存文章标签")
+ void saveTagArticle() throws UnsupportedEncodingException {
+ Article article = new Article();
+ BeanUtils.copyProperties(testArticle, article);
+ Integer integer = tagService.saveTagArticle(article, "article", testUser.getIdUser());
+ assertEquals(1, integer);
+ }
+
+ @Test
+ @DisplayName("清除未使用标签")
+ void cleanUnusedTag() throws Exception {
+ boolean b = tagService.cleanUnusedTag();
+ assertFalse(b);
+
+ Tag tag = new Tag();
+ tag.setTagDescription("test1");
+ tag.setTagTitle("test1");
+ Tag tag1 = tagService.saveTag(tag);
+ assertNotNull(tag1.getIdTag());
+
+ b = tagService.cleanUnusedTag();
+ assertTrue(b);
+ }
+
+ @Test
+ @DisplayName("添加/更新标签")
+ void saveTag() throws Exception {
+ List tagLabels = tagService.findTagLabels();
+ assertEquals(1, tagLabels.size());
+
+ Tag tag = new Tag();
+ tag.setTagDescription("test1");
+
+ assertThrows(IllegalArgumentException.class, () -> tagService.saveTag(tag));
+
+ tag.setTagTitle("test1");
+ Tag tag1 = tagService.saveTag(tag);
+ assertNotNull(tag1.getIdTag());
+
+ tagLabels = tagService.findTagLabels();
+ assertEquals(1, tagLabels.size());
+
+ tag.setIdTag(null);
+ assertThrows(BusinessException.class, () -> tagService.saveTag(tag));
+ }
+
+ @Test
+ @DisplayName("获取标签列表")
+ void findTagLabels() {
+ List tagLabels = tagService.findTagLabels();
+ assertFalse(tagLabels.isEmpty());
+ }
+}
\ No newline at end of file
diff --git a/src/test/java/com/rymcu/forest/service/TopicServiceTest.java b/src/test/java/com/rymcu/forest/service/TopicServiceTest.java
new file mode 100644
index 0000000..0bc01cf
--- /dev/null
+++ b/src/test/java/com/rymcu/forest/service/TopicServiceTest.java
@@ -0,0 +1,96 @@
+package com.rymcu.forest.service;
+
+import com.rymcu.forest.base.BaseServiceTest;
+import com.rymcu.forest.core.exception.BusinessException;
+import com.rymcu.forest.core.exception.ServiceException;
+import com.rymcu.forest.dto.admin.TagDTO;
+import com.rymcu.forest.dto.admin.TopicTagDTO;
+import com.rymcu.forest.entity.Tag;
+import com.rymcu.forest.entity.Topic;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.DisplayName;
+import org.junit.jupiter.api.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import java.util.List;
+
+import static org.junit.jupiter.api.Assertions.*;
+
+/**
+ * 主题test
+ */
+class TopicServiceTest extends BaseServiceTest {
+
+ @Autowired
+ private TopicService topicService;
+
+ @BeforeEach
+ void setUp() {
+ }
+
+ @Test
+ @DisplayName("获取导航主题数据")
+ void findTopicNav() {
+ List topicNav = topicService.findTopicNav();
+ assertTrue(topicNav.isEmpty());
+ }
+
+ @Test
+ @DisplayName("根据 topicUri 获取主题信息及旗下标签数据")
+ void findTopicByTopicUri() {
+ Topic topicNav = topicService.findTopicByTopicUri("rymcu.com/topic/123792");
+ assertNull(topicNav);
+ }
+
+ @Test
+ @DisplayName("新增/更新主题信息")
+ void saveTopic() {
+ Topic topic = new Topic();
+ assertThrows(IllegalArgumentException.class, () -> topicService.saveTopic(topic));
+
+ topic.setTopicTitle("test");
+ topicService.saveTopic(topic);
+ assertNotNull(topic.getIdTopic());
+
+ topic.setIdTopic(null);
+ assertThrows(BusinessException.class, () -> topicService.saveTopic(topic));
+
+ }
+
+ @Test
+ @DisplayName("查询未绑定标签")
+ void findUnbindTagsById() {
+ List tags = topicService.findUnbindTagsById(1L, "test");
+ assertTrue(tags.isEmpty());
+ }
+
+ @Test
+ @DisplayName("绑定标签")
+ void bindTopicTag() {
+ TopicTagDTO topicTagDTO = new TopicTagDTO();
+ topicTagDTO.setIdTag(1L);
+ topicTagDTO.setIdTopic(1L);
+ topicService.bindTopicTag(topicTagDTO);
+ assertNotNull(topicTagDTO.getIdTag());
+ }
+
+ @Test
+ @DisplayName("取消绑定标签")
+ void unbindTopicTag() {
+ TopicTagDTO topicTagDTO = new TopicTagDTO();
+ topicTagDTO.setIdTag(1L);
+ topicTagDTO.setIdTopic(1L);
+ assertThrows(ServiceException.class, () -> topicService.unbindTopicTag(topicTagDTO));
+
+ topicService.bindTopicTag(topicTagDTO);
+
+ assertDoesNotThrow(() -> topicService.unbindTopicTag(topicTagDTO));
+ }
+
+ @Test
+ @DisplayName("获取主题下标签列表")
+ void findTagsByTopicUri() {
+ List tags = topicService.findTagsByTopicUri("test.com/topic/123792");
+ assertNull(tags);
+ }
+}
\ No newline at end of file
diff --git a/src/test/java/com/rymcu/forest/service/TransactionRecordServiceTest.java b/src/test/java/com/rymcu/forest/service/TransactionRecordServiceTest.java
new file mode 100644
index 0000000..c640508
--- /dev/null
+++ b/src/test/java/com/rymcu/forest/service/TransactionRecordServiceTest.java
@@ -0,0 +1,70 @@
+package com.rymcu.forest.service;
+
+import com.rymcu.forest.base.BaseServiceTest;
+import com.rymcu.forest.dto.TransactionRecordDTO;
+import com.rymcu.forest.entity.TransactionRecord;
+import com.rymcu.forest.enumerate.TransactionEnum;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.DisplayName;
+import org.junit.jupiter.api.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import java.math.BigDecimal;
+import java.util.List;
+
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+class TransactionRecordServiceTest extends BaseServiceTest {
+
+ @Autowired
+ private TransactionRecordService transactionRecordService;
+
+ @BeforeEach
+ void setUp() {
+ }
+
+ @Test
+ void transfer() {
+ TransactionRecord transactionRecord = new TransactionRecord();
+ transactionRecord.setToBankAccount("100000061");
+ transactionRecord.setFormBankAccount("100000063");
+ transactionRecord.setMoney(BigDecimal.TEN);
+ transactionRecordService.transfer(transactionRecord);
+ assertNotNull(transactionRecord.getIdTransactionRecord());
+ }
+
+ @Test
+ @DisplayName("查询指定账户的交易记录")
+ void findTransactionRecords() {
+
+ List transactionRecords = transactionRecordService.findTransactionRecords("100000001", "2020-05-05", "2025-05-05");
+
+ assertTrue(transactionRecords.isEmpty());
+ }
+
+ @Test
+ @DisplayName("根据用户主键进行交易")
+ void userTransfer() {
+ TransactionRecord transactionRecord = transactionRecordService.userTransfer(65001L, 65003L, TransactionEnum.ArticleSponsor);
+ assertNotNull(transactionRecord);
+ assertNotNull(transactionRecord.getIdTransactionRecord());
+ }
+
+ @Test
+ @DisplayName("社区银行转账/奖励发放")
+ void bankTransfer() {
+ TransactionRecord transactionRecord = transactionRecordService.bankTransfer(65001L, TransactionEnum.Answer);
+ assertNotNull(transactionRecord);
+ assertNotNull(transactionRecord.getIdTransactionRecord());
+ }
+
+ @Test
+ @DisplayName("发放新手奖励")
+ void newbieRewards() {
+ TransactionRecord transactionRecord = new TransactionRecord();
+ transactionRecord.setToBankAccount("100000061");
+ transactionRecord = transactionRecordService.newbieRewards(transactionRecord);
+ assertNotNull(transactionRecord.getIdTransactionRecord());
+ }
+}
\ No newline at end of file
diff --git a/src/test/java/com/rymcu/forest/service/UserServiceTest.java b/src/test/java/com/rymcu/forest/service/UserServiceTest.java
new file mode 100644
index 0000000..815ac54
--- /dev/null
+++ b/src/test/java/com/rymcu/forest/service/UserServiceTest.java
@@ -0,0 +1,96 @@
+package com.rymcu.forest.service;
+
+import com.rymcu.forest.base.BaseServiceTest;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+class UserServiceTest extends BaseServiceTest {
+
+ @BeforeEach
+ void setUp() {
+ }
+
+ @Test
+ void findByAccount() {
+ }
+
+ @Test
+ void register() {
+ }
+
+ @Test
+ void login() {
+ }
+
+ @Test
+ void findUserDTOByAccount() {
+ }
+
+ @Test
+ void forgetPassword() {
+ }
+
+ @Test
+ void updateUserRole() {
+ }
+
+ @Test
+ void updateStatus() {
+ }
+
+ @Test
+ void findUserInfo() {
+ }
+
+ @Test
+ void updateUserInfo() {
+ }
+
+ @Test
+ void checkNicknameByIdUser() {
+ }
+
+ @Test
+ void findRoleWeightsByUser() {
+ }
+
+ @Test
+ void selectAuthor() {
+ }
+
+ @Test
+ void updateUserExtend() {
+ }
+
+ @Test
+ void selectUserExtendByAccount() {
+ }
+
+ @Test
+ void updateEmail() {
+ }
+
+ @Test
+ void updatePassword() {
+ }
+
+ @Test
+ void findUsers() {
+ }
+
+ @Test
+ void updateLastOnlineTimeByAccount() {
+ }
+
+ @Test
+ void findUserExtendInfo() {
+ }
+
+ @Test
+ void refreshToken() {
+ }
+
+ @Test
+ void findUserPermissions() {
+ }
+}
\ No newline at end of file
diff --git a/src/test/java/com/rymcu/forest/service/VisitServiceTest.java b/src/test/java/com/rymcu/forest/service/VisitServiceTest.java
new file mode 100644
index 0000000..35b3acc
--- /dev/null
+++ b/src/test/java/com/rymcu/forest/service/VisitServiceTest.java
@@ -0,0 +1,11 @@
+package com.rymcu.forest.service;
+
+import com.rymcu.forest.base.BaseServiceTest;
+import org.junit.jupiter.api.BeforeEach;
+
+class VisitServiceTest extends BaseServiceTest {
+
+ @BeforeEach
+ void setUp() {
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/application.yml b/src/test/resources/application.yml
new file mode 100644
index 0000000..9fcf3bd
--- /dev/null
+++ b/src/test/resources/application.yml
@@ -0,0 +1,4 @@
+# 打印mysql执行语句
+logging:
+ level:
+ com.rymcu.forest.mapper: DEBUG
\ No newline at end of file