Address PR review feedback

This commit is contained in:
kl
2026-04-13 21:02:59 +08:00
parent 7757729efd
commit a8a08c1dcc
3 changed files with 17 additions and 22 deletions

View File

@@ -28,14 +28,14 @@ public class PdfViewerCompatibilityTests {
@Test
void shouldOpenPdfPreviewWithThumbnailSidebarByDefault() throws IOException {
String pdfTemplate = readWebResource("/web/pdf.ftl");
String pdfTemplate = readResource("/web/pdf.ftl");
assertTrue(pdfTemplate.contains("#page=1&pagemode=thumbs"));
}
@Test
void shouldPreferPdfForOfficePreviewByDefault() throws IOException {
String properties = readConfigResource("/application.properties");
String properties = readResource("/application.properties");
assertTrue(properties.contains("office.preview.type = ${KK_OFFICE_PREVIEW_TYPE:pdf}"));
}
@@ -46,18 +46,4 @@ public class PdfViewerCompatibilityTests {
return new String(inputStream.readAllBytes(), StandardCharsets.UTF_8);
}
}
private String readWebResource(String resourcePath) throws IOException {
try (InputStream inputStream = getClass().getResourceAsStream(resourcePath)) {
assertNotNull(inputStream);
return new String(inputStream.readAllBytes(), StandardCharsets.UTF_8);
}
}
private String readConfigResource(String resourcePath) throws IOException {
try (InputStream inputStream = getClass().getResourceAsStream(resourcePath)) {
assertNotNull(inputStream);
return new String(inputStream.readAllBytes(), StandardCharsets.UTF_8);
}
}
}