Skip to content

Commit 3c20ce9

Browse files
authored
fix: Fix i18n test (opentiny#232)
1 parent c882c2d commit 3c20ce9

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

base/src/main/java/com/tinyengine/it/controller/I18nEntryController.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public class I18nEntryController {
7070
private I18nEntryService i18nEntryService;
7171

7272
/**
73-
* Gets all i 18 n entries by app.
73+
* Gets i 18 n entries by app.
7474
*
7575
* @return 获取国际化词条列表 i 18 n entries
7676
*/
@@ -79,7 +79,7 @@ public class I18nEntryController {
7979
content = @Content(mediaType = "application/json", schema = @Schema())),
8080
@ApiResponse(responseCode = "400", description = "请求失败")
8181
})
82-
@SystemControllerLog(description = "获取国际化词条列表")
82+
@SystemControllerLog(description = "通过app获取国际化词条列表")
8383
@GetMapping("/i18n/entries")
8484
public Result<I18nEntryListResult> getI18nEntriesByApp( @RequestParam(value = "host", required = false) Integer host,
8585
@RequestParam(value = "host_type", required = false) String hostType) {

base/src/test/java/com/tinyengine/it/controller/I18nEntryControllerTest.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,12 @@ void setUp() {
5858
}
5959

6060
@Test
61-
void testGetAllI18nEntries() {
61+
void testGetI18nEntriesByApp() {
6262
I18nEntryListResult mockData = new I18nEntryListResult();
63-
when(i18nEntryService.findAllI18nEntry()).thenReturn(mockData);
64-
65-
Result<I18nEntryListResult> result = i18nEntryController.getAllI18nEntries();
63+
when(i18nEntryService.findI18nEntryByApp(anyInt(), anyString())).thenReturn(mockData);
64+
Integer host = 1;
65+
String hostType = "app";
66+
Result<I18nEntryListResult> result = i18nEntryController.getI18nEntriesByApp(host, hostType);
6667
Assertions.assertEquals(mockData, result.getData());
6768
}
6869

0 commit comments

Comments
 (0)