🧪 没有测试的单元测试
没有测试的单元测试
This commit is contained in:
commit
f94ae6bdd8
2
.gitignore
vendored
2
.gitignore
vendored
@ -20,6 +20,8 @@ target/
|
||||
*.iml
|
||||
*.ipr
|
||||
/.mvn/
|
||||
.mvn
|
||||
forest.iml
|
||||
|
||||
### NetBeans ###
|
||||
/nbproject/private/
|
||||
|
BIN
.mvn/wrapper/maven-wrapper.jar
vendored
BIN
.mvn/wrapper/maven-wrapper.jar
vendored
Binary file not shown.
@ -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');
|
||||
|
179
forest.iml
179
forest.iml
@ -1,179 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
|
||||
<component name="FacetManager">
|
||||
<facet type="Spring" name="Spring">
|
||||
<configuration />
|
||||
</facet>
|
||||
<facet type="web" name="Web">
|
||||
<configuration>
|
||||
<webroots>
|
||||
<root url="file://$MODULE_DIR$/src/main/webapp" relative="/" />
|
||||
</webroots>
|
||||
<sourceRoots>
|
||||
<root url="file://$MODULE_DIR$/src/main/java" />
|
||||
<root url="file://$MODULE_DIR$/src/main/resources" />
|
||||
</sourceRoots>
|
||||
</configuration>
|
||||
</facet>
|
||||
</component>
|
||||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
|
||||
<output url="file://$MODULE_DIR$/target/classes" />
|
||||
<output-test url="file://$MODULE_DIR$/target/test-classes" />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/target" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-data-redis:2.7.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter:2.7.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot:2.7.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-logging:2.7.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: ch.qos.logback:logback-classic:1.2.11" level="project" />
|
||||
<orderEntry type="library" name="Maven: ch.qos.logback:logback-core:1.2.11" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.slf4j:jul-to-slf4j:1.7.36" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.data:spring-data-redis:2.7.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.data:spring-data-keyvalue:2.7.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.data:spring-data-commons:2.7.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-tx:5.3.22" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-oxm:5.3.22" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.lettuce:lettuce-core:6.1.9.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.netty:netty-common:4.1.79.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.netty:netty-handler:4.1.79.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.netty:netty-resolver:4.1.79.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.netty:netty-buffer:4.1.79.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.netty:netty-transport-native-unix-common:4.1.79.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.netty:netty-codec:4.1.79.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.netty:netty-transport:4.1.79.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.projectreactor:reactor-core:3.4.21" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.reactivestreams:reactive-streams:1.0.4" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.yaml:snakeyaml:1.32" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-mail:2.7.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-context-support:5.3.22" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-beans:5.3.22" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-context:5.3.22" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.sun.mail:jakarta.mail:1.6.7" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.sun.activation:jakarta.activation:1.2.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-web:2.7.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-json:2.7.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.13.3" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.13.3" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.module:jackson-module-parameter-names:2.13.3" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-web:5.3.22" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-webmvc:5.3.22" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-expression:5.3.22" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.mybatis.spring.boot:mybatis-spring-boot-starter:2.2.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-jdbc:2.7.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.zaxxer:HikariCP:4.0.3" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-jdbc:5.3.22" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.mybatis.spring.boot:mybatis-spring-boot-autoconfigure:2.2.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.mybatis:mybatis:3.5.9" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.mybatis:mybatis-spring:2.0.7" level="project" />
|
||||
<orderEntry type="library" scope="RUNTIME" name="Maven: mysql:mysql-connector-java:8.0.30" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.projectlombok:lombok:1.18.24" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.springframework.boot:spring-boot-starter-tomcat:2.7.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: jakarta.annotation:jakarta.annotation-api:1.3.5" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.tomcat.embed:tomcat-embed-core:9.0.65" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.tomcat.embed:tomcat-embed-el:9.0.65" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.tomcat.embed:tomcat-embed-websocket:9.0.65" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.springframework.boot:spring-boot-starter-test:2.7.2" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.springframework.boot:spring-boot-test:2.7.2" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.springframework.boot:spring-boot-test-autoconfigure:2.7.2" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: com.jayway.jsonpath:json-path:2.7.0" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: jakarta.xml.bind:jakarta.xml.bind-api:2.3.3" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: jakarta.activation:jakarta.activation-api:1.2.2" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.assertj:assertj-core:3.22.0" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest:2.2" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.junit.jupiter:junit-jupiter:5.8.2" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.junit.jupiter:junit-jupiter-api:5.8.2" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.opentest4j:opentest4j:1.2.0" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.junit.platform:junit-platform-commons:1.8.2" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.apiguardian:apiguardian-api:1.1.2" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.junit.jupiter:junit-jupiter-params:5.8.2" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.junit.jupiter:junit-jupiter-engine:5.8.2" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.junit.platform:junit-platform-engine:1.8.2" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.mockito:mockito-core:4.5.1" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: net.bytebuddy:byte-buddy:1.12.12" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: net.bytebuddy:byte-buddy-agent:1.12.12" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.objenesis:objenesis:3.2" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.mockito:mockito-junit-jupiter:4.5.1" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.skyscreamer:jsonassert:1.5.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-core:5.3.22" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-jcl:5.3.22" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.springframework:spring-test:5.3.22" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.xmlunit:xmlunit-core:2.9.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: net.minidev:json-smart:2.4.8" level="project" />
|
||||
<orderEntry type="library" name="Maven: net.minidev:accessors-smart:2.4.8" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.ow2.asm:asm:9.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-aop:2.7.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-aop:5.3.22" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.aspectj:aspectjweaver:1.9.7" level="project" />
|
||||
<orderEntry type="library" name="Maven: tk.mybatis:mapper:4.2.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: javax.persistence:persistence-api:1.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper:5.3.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.github.jsqlparser:jsqlparser:4.5" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.alibaba:fastjson:2.0.14" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.alibaba.fastjson2:fastjson2-extension:2.0.14" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.alibaba.fastjson2:fastjson2:2.0.14" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.shiro:shiro-spring:1.9.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.shiro:shiro-core:1.9.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.shiro:shiro-lang:1.9.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.shiro:shiro-cache:1.9.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.shiro:shiro-crypto-hash:1.9.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.shiro:shiro-crypto-core:1.9.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.shiro:shiro-crypto-cipher:1.9.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.shiro:shiro-config-core:1.9.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.shiro:shiro-config-ogdl:1.9.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: commons-beanutils:commons-beanutils:1.9.4" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.shiro:shiro-event:1.9.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.shiro:shiro-web:1.9.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.owasp.encoder:encoder:1.2.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.commons:commons-collections4:4.4" level="project" />
|
||||
<orderEntry type="library" name="Maven: commons-lang:commons-lang:2.6" level="project" />
|
||||
<orderEntry type="library" name="Maven: commons-io:commons-io:2.11.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.commons:commons-text:1.9" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.commons:commons-lang3:3.12.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: commons-codec:commons-codec:1.15" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.jsonwebtoken:jjwt:0.9.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.13.3" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.13.3" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-core:2.13.3" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.alibaba:druid-spring-boot-starter:1.2.13-SNSAPSHOT" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.alibaba:druid:1.2.13-SNSAPSHOT" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.36" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-autoconfigure:2.7.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-to-slf4j:2.19.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-api:2.19.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-configuration-processor:2.7.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-thymeleaf:2.7.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.thymeleaf:thymeleaf-spring5:3.0.15.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.thymeleaf:thymeleaf:3.0.15.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.attoparser:attoparser:2.0.5.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.unbescape:unbescape:1.1.6.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.thymeleaf.extras:thymeleaf-extras-java8time:3.0.4.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-websocket:2.7.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-messaging:5.3.22" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-websocket:5.3.22" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.jodd:jodd-http:6.3.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.jodd:jodd-util:6.1.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.github.jedis-lock:jedis-lock:1.0.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: redis.clients:jedis:3.8.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.commons:commons-pool2:2.11.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.lucene:lucene-queryparser:8.11.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.lucene:lucene-core:8.11.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.lucene:lucene-queries:8.11.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.lucene:lucene-sandbox:8.11.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.lucene:lucene-analyzers-common:8.11.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.lucene:lucene-highlighter:8.11.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.lucene:lucene-memory:8.11.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.lucene:lucene-suggest:8.11.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: cn.hutool:hutool-core:5.8.7" level="project" />
|
||||
<orderEntry type="library" name="Maven: cn.hutool:hutool-http:5.8.7" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.warrenstrange:googleauth:1.5.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpclient:4.5.13" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpcore:4.4.15" level="project" />
|
||||
</component>
|
||||
</module>
|
@ -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;
|
||||
}
|
||||
|
@ -4,6 +4,8 @@ import com.rymcu.forest.core.service.Service;
|
||||
import com.rymcu.forest.entity.ArticleThumbsUp;
|
||||
|
||||
/**
|
||||
* 点赞
|
||||
*
|
||||
* @author ronger
|
||||
*/
|
||||
public interface ArticleThumbsUpService extends Service<ArticleThumbsUp> {
|
||||
|
@ -9,6 +9,8 @@ import com.rymcu.forest.entity.BankAccount;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 银行账户服务
|
||||
*
|
||||
* @author ronger
|
||||
*/
|
||||
public interface BankAccountService extends Service<BankAccount> {
|
||||
|
@ -7,6 +7,8 @@ import com.rymcu.forest.entity.Bank;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 银行
|
||||
*
|
||||
* @author ronger
|
||||
*/
|
||||
public interface BankService extends Service<Bank> {
|
||||
|
@ -63,7 +63,7 @@ public interface NotificationService extends Service<Notification> {
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
Integer readAllNotification();
|
||||
Integer readAllNotification(Long idUser);
|
||||
|
||||
/**
|
||||
* 删除相关未读消息
|
||||
|
@ -11,6 +11,8 @@ import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 银行
|
||||
*
|
||||
* @author ronger
|
||||
*/
|
||||
@Service
|
||||
|
@ -73,8 +73,8 @@ public class NotificationServiceImpl extends AbstractService<Notification> imple
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer readAllNotification() {
|
||||
return notificationMapper.readAllNotification(Objects.requireNonNull(UserUtils.getCurrentUserByToken()).getIdUser());
|
||||
public Integer readAllNotification(Long idUser) {
|
||||
return notificationMapper.readAllNotification(idUser);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -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("标记已读失败");
|
||||
}
|
||||
|
16
src/test/java/com/rymcu/forest/base/BaseServiceTest.java
Normal file
16
src/test/java/com/rymcu/forest/base/BaseServiceTest.java
Normal file
@ -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 {
|
||||
}
|
@ -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<ArticleDTO> 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<ArticleDTO> userArticlesByIdUser = articleService.findUserArticlesByIdUser(testArticle.getArticleAuthorId());
|
||||
assertNotEquals(Collections.emptyList(), userArticlesByIdUser);
|
||||
assertTrue(CollectionUtil.isNotEmpty(userArticlesByIdUser));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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<ArticleDTO> articles = articleService.findArticles(articleSearchDTO);
|
||||
articleThumbsUp.setIdArticle(articles.get(0).getIdArticle());
|
||||
});
|
||||
|
||||
int i = articleThumbsUpService.thumbsUp(articleThumbsUp);
|
||||
assertEquals(1, i);
|
||||
}
|
||||
|
||||
}
|
@ -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<BankAccountDTO> 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<TransactionRecordDTO> userTransactionRecords = bankAccountService.findUserTransactionRecords(idUser.toString(), "", "");
|
||||
assertTrue(userTransactionRecords.isEmpty());
|
||||
}
|
||||
}
|
27
src/test/java/com/rymcu/forest/service/BankServiceTest.java
Normal file
27
src/test/java/com/rymcu/forest/service/BankServiceTest.java
Normal file
@ -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<BankDTO> banks = bankService.findBanks();
|
||||
assertEquals(2L, banks.size());
|
||||
}
|
||||
|
||||
|
||||
}
|
154
src/test/java/com/rymcu/forest/service/CommentServiceTest.java
Normal file
154
src/test/java/com/rymcu/forest/service/CommentServiceTest.java
Normal file
@ -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<ArticleTagDTO> 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("<h1>Test</h1>")
|
||||
.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<CommentDTO> 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<CommentDTO> articleComments = commentService.getArticleComments(testArticle.getIdArticle().intValue());
|
||||
assertEquals(1, articleComments.size());
|
||||
|
||||
List<CommentDTO> findComments = commentService.findComments();
|
||||
assertEquals(1, findComments.size());
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("获取评论列表数据")
|
||||
void findComments() {
|
||||
Integer idArticle = testArticle.getIdArticle().intValue();
|
||||
List<CommentDTO> articleComments = commentService.findComments();
|
||||
assertEquals(0, articleComments.size());
|
||||
}
|
||||
}
|
@ -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<CurrencyRule> all = currencyRuleService.findAll();
|
||||
assertEquals(0, all.size());
|
||||
}
|
||||
|
||||
}
|
@ -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<UserInfoDTO> result = dashboardService.newUsers();
|
||||
assertEquals(0L, result.size());
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("获取新增银行账号列表")
|
||||
void newBankAccounts() {
|
||||
List<BankAccountDTO> result = dashboardService.newBankAccounts();
|
||||
assertEquals(0L, result.size());
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("获取新增文章列表")
|
||||
void newArticles() {
|
||||
List<ArticleDTO> result = dashboardService.newArticles();
|
||||
assertEquals(0L, result.size());
|
||||
}
|
||||
}
|
@ -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<Follow> list = followService.findByFollowingId(followingType, followingId);
|
||||
assertTrue(list.isEmpty());
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("查询用户粉丝")
|
||||
void findUserFollowersByUser() {
|
||||
UserDTO userDTO = new UserDTO();
|
||||
userDTO.setIdUser(idUser);
|
||||
List<UserDTO> list = followService.findUserFollowersByUser(userDTO);
|
||||
assertTrue(list.isEmpty());
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("查询用户关注用户")
|
||||
void findUserFollowingsByUser() {
|
||||
UserDTO userDTO = new UserDTO();
|
||||
userDTO.setIdUser(idUser);
|
||||
List<UserDTO> list = followService.findUserFollowingsByUser(userDTO);
|
||||
assertTrue(list.isEmpty());
|
||||
}
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
@ -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()));
|
||||
|
||||
}
|
||||
}
|
@ -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<LoginRecord> loginRecordByIdUser = loginRecordService.findLoginRecordByIdUser(1);
|
||||
assertTrue(loginRecordByIdUser.isEmpty());
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
@DisplayName("测试全部")
|
||||
void doAll() {
|
||||
LoginRecord loginRecord = loginRecordService.saveLoginRecord(1L);
|
||||
assertNotNull(loginRecord);
|
||||
|
||||
List<LoginRecord> loginRecordByIdUser = loginRecordService.findLoginRecordByIdUser(1);
|
||||
assertFalse(loginRecordByIdUser.isEmpty());
|
||||
|
||||
}
|
||||
}
|
@ -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<Notification> unreadNotifications = notificationService.findUnreadNotifications(idUser);
|
||||
assertFalse(unreadNotifications.isEmpty());
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("获取消息数据")
|
||||
void findNotifications() {
|
||||
List<NotificationDTO> 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<Notification> 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<Notification> 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<Notification> 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());
|
||||
}
|
||||
}
|
@ -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());
|
||||
}
|
||||
}
|
@ -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);
|
||||
});
|
||||
}
|
||||
}
|
254
src/test/java/com/rymcu/forest/service/PortfolioServiceTest.java
Normal file
254
src/test/java/com/rymcu/forest/service/PortfolioServiceTest.java
Normal file
@ -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<ArticleTagDTO> 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("<h1>Test</h1>")
|
||||
.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<PortfolioDTO> 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<PortfolioDTO> 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<ArticleDTO> 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<PortfolioDTO> portfolios = portfolioService.findPortfolios();
|
||||
assertTrue(portfolios.isEmpty());
|
||||
|
||||
portfolioService.postPortfolio(portfolio);
|
||||
portfolios = portfolioService.findPortfolios();
|
||||
assertFalse(portfolios.isEmpty());
|
||||
}
|
||||
}
|
@ -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<ProductDTO> 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());
|
||||
}
|
||||
}
|
68
src/test/java/com/rymcu/forest/service/RoleServiceTest.java
Normal file
68
src/test/java/com/rymcu/forest/service/RoleServiceTest.java
Normal file
@ -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<Role> roles = roleService.selectRoleByUser(user);
|
||||
assertFalse(roles.isEmpty());
|
||||
|
||||
user.setIdUser(0L);
|
||||
roleService.selectRoleByUser(user);
|
||||
assertFalse(roles.isEmpty());
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("查询用户角色")
|
||||
void findByIdUser() {
|
||||
List<Role> 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);
|
||||
}
|
||||
}
|
@ -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() {
|
||||
}
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
145
src/test/java/com/rymcu/forest/service/TagServiceTest.java
Normal file
145
src/test/java/com/rymcu/forest/service/TagServiceTest.java
Normal file
@ -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<ArticleTagDTO> 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("<h1>Test</h1>")
|
||||
.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<LabelModel> 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<LabelModel> tagLabels = tagService.findTagLabels();
|
||||
assertFalse(tagLabels.isEmpty());
|
||||
}
|
||||
}
|
96
src/test/java/com/rymcu/forest/service/TopicServiceTest.java
Normal file
96
src/test/java/com/rymcu/forest/service/TopicServiceTest.java
Normal file
@ -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<Topic> 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<Tag> 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<TagDTO> tags = topicService.findTagsByTopicUri("test.com/topic/123792");
|
||||
assertNull(tags);
|
||||
}
|
||||
}
|
@ -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<TransactionRecordDTO> 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());
|
||||
}
|
||||
}
|
96
src/test/java/com/rymcu/forest/service/UserServiceTest.java
Normal file
96
src/test/java/com/rymcu/forest/service/UserServiceTest.java
Normal file
@ -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() {
|
||||
}
|
||||
}
|
11
src/test/java/com/rymcu/forest/service/VisitServiceTest.java
Normal file
11
src/test/java/com/rymcu/forest/service/VisitServiceTest.java
Normal file
@ -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() {
|
||||
}
|
||||
}
|
4
src/test/resources/application.yml
Normal file
4
src/test/resources/application.yml
Normal file
@ -0,0 +1,4 @@
|
||||
# 打印mysql执行语句
|
||||
logging:
|
||||
level:
|
||||
com.rymcu.forest.mapper: DEBUG
|
Loading…
Reference in New Issue
Block a user