test: 补充后端单元测试与覆盖率配置
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
package com.guo.learningprogresstracker;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
|
||||
|
||||
/**
|
||||
* 应用启动类 main 方法覆盖测试:
|
||||
* 以非 Web 模式 + H2 内存库拉起 Spring 容器,正常返回即覆盖 main 方法体两行。
|
||||
*/
|
||||
class ApplicationMainTest {
|
||||
|
||||
@Test
|
||||
void main_startsApplicationContextInNonWebMode() {
|
||||
assertDoesNotThrow(() -> LearningProgressTrackerApplication.main(new String[]{
|
||||
"--spring.main.web-application-type=none",
|
||||
"--spring.datasource.driver-class-name=org.h2.Driver",
|
||||
"--spring.datasource.url=jdbc:h2:mem:lpt_main_test;MODE=MySQL;DATABASE_TO_LOWER=TRUE;CASE_INSENSITIVE_IDENTIFIERS=TRUE;NON_KEYWORDS=USER",
|
||||
"--spring.datasource.username=sa",
|
||||
"--spring.datasource.password=",
|
||||
"--spring.flyway.enabled=false",
|
||||
"--mybatis-plus.configuration.log-impl=org.apache.ibatis.logging.nologging.NoLoggingImpl"
|
||||
}));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user