1. 更新语法检查问题

2. 更新测试配置
This commit is contained in:
黄昕 2024-03-12 11:17:05 +08:00
parent b638918697
commit 76525106b4
8 changed files with 26 additions and 39 deletions

View File

@ -33,13 +33,13 @@ spring :
fail-on-unknown-properties: false
datasource:
#url : jdbc:mysql://xajhuang.com:3307/common_framework?serverTimezone=Asia/Shanghai&zeroDateTimeBehavior=convertToNull&useUnicode=true
url : jdbc:mysql://localhost:3306/common_framework?serverTimezone=Asia/Shanghai&zeroDateTimeBehavior=convertToNull&useUnicode=true
url : jdbc:mysql://xajhuang.com:3307/common_framework?serverTimezone=Asia/Shanghai&zeroDateTimeBehavior=convertToNull&useUnicode=true
#url : jdbc:mysql://localhost:3306/common_framework?serverTimezone=Asia/Shanghai&zeroDateTimeBehavior=convertToNull&useUnicode=true
driver-class-name: com.mysql.cj.jdbc.Driver
#username : xajhuang
#password : wkj!nky5cjb!GMV6guq
username : root
password : aaaHuang1
username : xajhuang
password : wkj!nky5cjb!GMV6guq
#username : root
#password : aaaHuang1
dbcp2 :
max-total : 128
max-wait-millis : 10000

View File

@ -2,10 +2,8 @@ package com.cf.cs.authentication;
import com.cf.cs.authentication.configure.SecuritySecurity;
import com.cf.cs.authentication.configure.UserSecurityConfigure;
import com.cf.cs.base.CsBaseApplication;
import com.cf.cs.base.config.CacheConfigure;
import com.cf.cs.base.config.CommonConfigure;
import com.cf.cs.database.CsDatabaseApplication;
import com.cf.cs.database.config.MybatisFlexConfigure;
import com.cf.cs.protocol.config.ProtocolConfigure;
import org.junit.jupiter.api.Test;

View File

@ -76,7 +76,7 @@ public abstract class TestBaseAuthentication {
// 假设JWT在响应体中返回您需要根据实际情况调整此行代码
String respJson = mvcResult.getResponse().getContentAsString();
Assertions.assertNotNull(respJson);
Assertions.assertNotEquals(respJson.length(), 0);
Assertions.assertNotEquals(0, respJson.length());
ProtocolResp<?> resp = ProtocolJsonUtils.jsonGetProtocolResp(respJson, LoginResp.class);
Assertions.assertNotNull(resp);
@ -87,7 +87,7 @@ public abstract class TestBaseAuthentication {
Assertions.assertEquals(loginResp.getStatus(), ErrorCode.ERR_OK.getCode());
Assertions.assertNotNull(loginResp.getToken());
Assertions.assertNotEquals(loginResp.getToken().length(), 0);
Assertions.assertNotEquals(0, loginResp.getToken().length());
HttpHeaders headers = new HttpHeaders();
MediaType type = MediaType.parseMediaType("application/json; charset=UTF-8");
@ -169,7 +169,7 @@ public abstract class TestBaseAuthentication {
Assertions.assertNotNull(resp);
Assertions.assertNotNull(resp.getStatus());
Assertions.assertNotNull(resp.getMessage());
Assertions.assertNotEquals(resp.getMessage().length, 0);
Assertions.assertNotEquals(0, resp.getMessage().length);
Assertions.assertEquals(resp.getStatus(), ErrorCode.ERR_OK.getCode());
}
}

View File

@ -6,7 +6,6 @@ import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
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;
import org.springframework.web.bind.annotation.RequestMethod;
@ -17,7 +16,7 @@ public class CommonFrameworkApiTest extends TestBaseAuthentication {
@Test
@DisplayName("获取版本信息")
void testGetVersion() throws Exception {
VersionResp resp = (VersionResp) performanceRestful(RequestMethod.GET, null, "/api/version", new Class[]{VersionResp.class});
VersionResp resp = (VersionResp) performanceRestful(RequestMethod.GET, null, "/api/version", new Class[] {VersionResp.class});
AssertValidCommonResp(resp);
Assertions.assertNotNull(resp.getVersion());
@ -32,7 +31,7 @@ public class CommonFrameworkApiTest extends TestBaseAuthentication {
@Test
@DisplayName("获取版本信息(POST)")
void testGetVersionV2() throws Exception {
VersionResp resp = (VersionResp) performanceRestful(RequestMethod.POST, null, "/api/version", new Class[]{VersionResp.class});
VersionResp resp = (VersionResp) performanceRestful(RequestMethod.POST, null, "/api/version", new Class[] {VersionResp.class});
AssertValidCommonResp(resp);
Assertions.assertNotNull(resp.getVersion());

View File

@ -15,7 +15,6 @@ import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInstance;
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;
import org.springframework.web.bind.annotation.RequestMethod;
@ -87,8 +86,7 @@ public class OperationLogApiTest extends TestBaseAuthentication {
OperationLogDetailsReq req = new OperationLogDetailsReq(optIdArray);
Object obj = performanceRestful(RequestMethod.POST, req, "/api/operation/details",
new Class[] {OperationLogDetailsResp.class});
Object obj = performanceRestful(RequestMethod.POST, req, "/api/operation/details", new Class[] {OperationLogDetailsResp.class});
Assertions.assertNotNull(obj);
OperationLogDetailsResp resp = (OperationLogDetailsResp) obj;
AssertValidCommonResp(resp);

View File

@ -19,7 +19,6 @@ import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInstance;
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;
import org.springframework.web.bind.annotation.RequestMethod;
@ -147,8 +146,7 @@ public class PermissionManagerApiTest extends TestBaseAuthentication {
IdArrayReq req = new IdArrayReq(rid);
RegisterResourceResp resp = (RegisterResourceResp) performanceRestful(RequestMethod.DELETE, req,
"/api/permission/resource",
RegisterResourceResp resp = (RegisterResourceResp) performanceRestful(RequestMethod.DELETE, req, "/api/permission/resource",
new Class[] {RegisterResourceResp.class});
AssertValidCommonResp(resp);
Assertions.assertNotNull(resp.getResult());
@ -179,12 +177,9 @@ public class PermissionManagerApiTest extends TestBaseAuthentication {
.httpMethod(new ArrayList<>() {{add("PUT");}})
.build());
RegisterResourceReq req = RegisterResourceReq.builder()
.resources(resList)
.build();
RegisterResourceReq req = RegisterResourceReq.builder().resources(resList).build();
RegisterResourceResp resp = (RegisterResourceResp) performanceRestful(RequestMethod.PUT, req,
"/api/permission/resource",
RegisterResourceResp resp = (RegisterResourceResp) performanceRestful(RequestMethod.PUT, req, "/api/permission/resource",
new Class[] {RegisterResourceResp.class});
AssertValidCommonResp(resp);
@ -207,8 +202,7 @@ public class PermissionManagerApiTest extends TestBaseAuthentication {
testRegisterResource();
IdArrayReq req = new IdArrayReq(addResUid);
RegisterResourceResp resp = (RegisterResourceResp) performanceRestful(RequestMethod.DELETE, req,
"/api/permission/resource",
RegisterResourceResp resp = (RegisterResourceResp) performanceRestful(RequestMethod.DELETE, req, "/api/permission/resource",
new Class[] {RegisterResourceResp.class});
AssertValidCommonResp(resp);
Assertions.assertNotNull(resp.getResult());

View File

@ -3,7 +3,6 @@ package com.cf.cs.integratetest.controller;
import com.cf.cs.integratetest.common.TestBaseAuthentication;
import org.junit.jupiter.api.Test;
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;
@ -11,27 +10,27 @@ import org.springframework.transaction.annotation.Transactional;
@Transactional
public class SystemDictControllerTest extends TestBaseAuthentication {
@Test
void testGetEnumDictionary() throws Exception {
void testGetEnumDictionary() {
}
@Test
void testGetEnumDictionary_DictionaryServiceReturnsNoItems() throws Exception {
void testGetEnumDictionary_DictionaryServiceReturnsNoItems() {
}
@Test
void testGetEnumDictionaryContent() throws Exception {
void testGetEnumDictionaryContent() {
}
@Test
void testGetEnumDictionaryContent_DictionaryServiceReturnsNoItems() throws Exception {
void testGetEnumDictionaryContent_DictionaryServiceReturnsNoItems() {
}
@Test
void testCreateNewDictionary() throws Exception {
void testCreateNewDictionary() {
}
}

View File

@ -6,7 +6,6 @@ import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInstance;
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;
@ -16,27 +15,27 @@ import org.springframework.transaction.annotation.Transactional;
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
public class UserManagerApiTest extends TestBaseAuthentication {
@Test
void testGetUserInfoById() throws Exception {
void testGetUserInfoById() {
}
@Test
void testGetAllUserInfoPaged() throws Exception {
void testGetAllUserInfoPaged() {
}
@Test
void testGetCurrentUserInfo() throws Exception {
void testGetCurrentUserInfo() {
}
@Test
void testCreateNewUser() throws Exception {
void testCreateNewUser() {
}
@Test
void testRemoveUser() throws Exception {
void testRemoveUser() {
}
}