Skip to content

Commit 5db2ba8

Browse files
Thomasrludomikula
Thomasr
authored andcommitted
fix test issue
1 parent db0357e commit 5db2ba8

File tree

4 files changed

+21
-12
lines changed

4 files changed

+21
-12
lines changed

server/api-service/lowcoder-server/src/test/java/org/lowcoder/api/application/ApplicationApiServiceTest.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33

44
import lombok.extern.slf4j.Slf4j;
55
import org.junit.jupiter.api.Assertions;
6-
import org.junit.jupiter.api.BeforeEach;
6+
import org.junit.jupiter.api.BeforeAll;
77
import org.junit.jupiter.api.Test;
8+
import org.junit.jupiter.api.TestInstance;
89
import org.lowcoder.api.application.ApplicationEndpoints.CreateApplicationRequest;
910
import org.lowcoder.api.application.view.ApplicationPermissionView;
1011
import org.lowcoder.api.application.view.ApplicationView;
@@ -36,6 +37,8 @@
3637
//@RunWith(SpringRunner.class)
3738
@ActiveProfiles("ApplicationApiServiceTest")
3839
@Slf4j(topic = "ApplicationApiServiceTest")
40+
41+
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
3942
public class ApplicationApiServiceTest {
4043

4144
@Autowired
@@ -49,8 +52,8 @@ public class ApplicationApiServiceTest {
4952
@Autowired
5053
private InitData initData;
5154

52-
@BeforeEach
53-
public void beforeEach() {
55+
@BeforeAll
56+
public void beforeAll() {
5457
initData.init();
5558
}
5659

server/api-service/lowcoder-server/src/test/java/org/lowcoder/api/application/CompoundApplicationDslFilterTest.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22

33
import org.apache.commons.collections4.MapUtils;
44
import org.junit.jupiter.api.Assertions;
5-
import org.junit.jupiter.api.BeforeEach;
5+
import org.junit.jupiter.api.BeforeAll;
66
import org.junit.jupiter.api.Test;
7+
import org.junit.jupiter.api.TestInstance;
78
import org.lowcoder.api.common.InitData;
89
import org.lowcoder.api.common.mockuser.WithMockUser;
910
import org.lowcoder.sdk.constants.DslConstants.CompoundAppDslConstants;
@@ -19,15 +20,16 @@
1920
@SpringBootTest
2021
@ActiveProfiles("test")
2122
//@RunWith(SpringRunner.class)
23+
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
2224
public class CompoundApplicationDslFilterTest {
2325

2426
@Autowired
2527
private CompoundApplicationDslFilter filter;
2628
@Autowired
2729
private InitData initData;
2830

29-
@BeforeEach
30-
public void beforeEach() {
31+
@BeforeAll
32+
public void beforeAll() {
3133
initData.init();
3234
}
3335

server/api-service/lowcoder-server/src/test/java/org/lowcoder/api/bundle/BundleApiServiceImplTest.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
package org.lowcoder.api.bundle;
22

33
import org.junit.jupiter.api.Assertions;
4-
import org.junit.jupiter.api.BeforeEach;
4+
import org.junit.jupiter.api.BeforeAll;
55
import org.junit.jupiter.api.Test;
6+
import org.junit.jupiter.api.TestInstance;
67
import org.lowcoder.api.bundle.view.BundleInfoView;
78
import org.lowcoder.api.bundle.view.BundlePermissionView;
89
import org.lowcoder.api.common.InitData;
@@ -33,6 +34,7 @@
3334
@SpringBootTest
3435
//@RunWith(SpringRunner.class)
3536
@ActiveProfiles("BundleApiServiceImplTest")
37+
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
3638
public class BundleApiServiceImplTest {
3739
@Autowired
3840
BundleApiServiceImpl bundleApiService;
@@ -43,8 +45,8 @@ public class BundleApiServiceImplTest {
4345
@Autowired
4446
private InitData initData;
4547

46-
@BeforeEach
47-
public void beforeEach() {
48+
@BeforeAll
49+
public void beforeAll() {
4850
initData.init();
4951
}
5052

server/api-service/lowcoder-server/src/test/java/org/lowcoder/api/service/FolderApiServiceTest.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
package org.lowcoder.api.service;
22

33
import org.junit.jupiter.api.Assertions;
4-
import org.junit.jupiter.api.BeforeEach;
4+
import org.junit.jupiter.api.BeforeAll;
55
import org.junit.jupiter.api.Test;
6+
import org.junit.jupiter.api.TestInstance;
67
import org.lowcoder.api.application.view.ApplicationInfoView;
78
import org.lowcoder.api.application.view.ApplicationPermissionView;
89
import org.lowcoder.api.common.InitData;
@@ -29,6 +30,7 @@
2930
@SpringBootTest
3031
@ActiveProfiles("test")
3132
//@RunWith(SpringRunner.class)
33+
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
3234
public class FolderApiServiceTest {
3335

3436
@Autowired
@@ -38,8 +40,8 @@ public class FolderApiServiceTest {
3840
@Autowired
3941
private InitData initData;
4042

41-
@BeforeEach
42-
public void beforeEach() {
43+
@BeforeAll
44+
public void beforeAll() {
4345
initData.init();
4446
}
4547

0 commit comments

Comments
 (0)