Skip to content

Commit 734ed35

Browse files
committed
fix: modify tenant API
1 parent 7aef861 commit 734ed35

File tree

4 files changed

+8
-21
lines changed

4 files changed

+8
-21
lines changed

base/src/test/java/com/tinyengine/it/common/handler/MyMetaObjectHandlerTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ void testInsertFill() throws NoSuchFieldException, IllegalAccessException {
3636
when(param.hasSetter("tenantId")).thenReturn(true);
3737
TestUtil.setPrivateValue(myMetaObjectHandler, "loginUserContext", new MockUserContext());
3838
myMetaObjectHandler.insertFill(param);
39-
verify(param, times(6)).hasSetter(anyString());
39+
verify(param, times(5)).hasSetter(anyString());
4040
}
4141

4242
@Test

base/src/test/java/com/tinyengine/it/service/app/impl/AppServiceImplTest.java

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,6 @@ class AppServiceImplTest {
6565
@InjectMocks
6666
private AppServiceImpl appServiceImpl;
6767

68-
@Mock
69-
LoginUserContext loginUserContext;
70-
71-
private String TENANTID = loginUserContext.getTenantId();
7268
@BeforeEach
7369
void setUp() {
7470
MockitoAnnotations.openMocks(this);
@@ -78,7 +74,7 @@ void setUp() {
7874
@Test
7975
void testQueryAllApp() {
8076
List<App> mockData = Arrays.<App>asList(new App());
81-
when(appMapper.queryAllApp(TENANTID)).thenReturn(mockData);
77+
when(appMapper.queryAllApp("1")).thenReturn(mockData);
8278

8379
List<App> result = appServiceImpl.queryAllApp();
8480
Assertions.assertEquals(mockData, result);
@@ -87,7 +83,7 @@ void testQueryAllApp() {
8783
@Test
8884
void testQueryAppById() {
8985
App app = new App();
90-
when(appMapper.queryAppById(1, TENANTID)).thenReturn(app);
86+
when(appMapper.queryAppById(1, "1")).thenReturn(app);
9187

9288
Result<App> result = appServiceImpl.queryAppById(1);
9389
Assertions.assertEquals(app, result.getData());
@@ -105,8 +101,8 @@ void testQueryAppByCondition() {
105101
@Test
106102
void testDeleteAppById() {
107103
App app = new App();
108-
when(appMapper.queryAppById(1, TENANTID)).thenReturn(app);
109-
when(appMapper.deleteAppById(1, TENANTID)).thenReturn(2);
104+
when(appMapper.queryAppById(1, "1")).thenReturn(app);
105+
when(appMapper.deleteAppById(1, "1")).thenReturn(2);
110106

111107
Result<App> result = appServiceImpl.deleteAppById(1);
112108
Assertions.assertEquals(app, result.getData());
@@ -120,7 +116,7 @@ void testUpdateAppById() {
120116

121117
resultApp.setExtendConfig(mockConfig);
122118
int appId = 1;
123-
when(appMapper.queryAppById(appId, TENANTID)).thenReturn(resultApp);
119+
when(appMapper.queryAppById(appId, "1")).thenReturn(resultApp);
124120
App param = new App();
125121
param.setId(appId);
126122

base/src/test/java/com/tinyengine/it/service/material/impl/BlockServiceImplTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ void testListNewWhenGroupIdNotEmpty() {
290290

291291
App app = new App();
292292
app.setId(1);
293-
when(appMapper.queryAppById(anyInt())).thenReturn(app);
293+
when(appMapper.queryAppById(anyInt(), anyString())).thenReturn(app);
294294

295295
Result<List<Block>> result = blockServiceImpl.listNew("1", "1");
296296
Assertions.assertEquals(blocksList, result.getData());
@@ -307,7 +307,7 @@ void testListNewWhenGroupIdIsEmpty() {
307307

308308
App app = new App();
309309
app.setId(1);
310-
when(appMapper.queryAppById(anyInt())).thenReturn(app);
310+
when(appMapper.queryAppById(anyInt(), anyString())).thenReturn(app);
311311

312312
HashMap<String, String> param = new HashMap<>();
313313

base/src/test/java/com/tinyengine/it/service/platform/impl/TenantServiceImplTest.java

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -90,13 +90,4 @@ void testUpdateTenantById() {
9090
Integer result = tenantServiceImpl.updateTenantById(param);
9191
Assertions.assertEquals(2, result);
9292
}
93-
94-
@Test
95-
void testCreateTenant() {
96-
Tenant param = new Tenant();
97-
when(tenantMapper.createTenant(param)).thenReturn(2);
98-
99-
Integer result = tenantServiceImpl.createTenant(param);
100-
Assertions.assertEquals(2, result);
101-
}
10293
}

0 commit comments

Comments
 (0)