diff --git a/server/src/test/java/cn/keking/PdfViewerCompatibilityTests.java b/server/src/test/java/cn/keking/PdfViewerCompatibilityTests.java index 84f92633..0f9c9c5f 100644 --- a/server/src/test/java/cn/keking/PdfViewerCompatibilityTests.java +++ b/server/src/test/java/cn/keking/PdfViewerCompatibilityTests.java @@ -6,26 +6,29 @@ import java.io.IOException; import java.io.InputStream; import java.nio.charset.StandardCharsets; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; + public class PdfViewerCompatibilityTests { @Test void shouldLoadCompatibilityModuleBeforePdfJs() throws IOException { String viewerHtml = readResource("/static/pdfjs/web/viewer.html"); - assert viewerHtml.contains(""); - assert viewerHtml.indexOf("compatibility.mjs") < viewerHtml.indexOf("../build/pdf.mjs"); + assertTrue(viewerHtml.contains("")); + assertTrue(viewerHtml.indexOf("compatibility.mjs") < viewerHtml.indexOf("../build/pdf.mjs")); } @Test void shouldLoadCompatibilityModuleInPdfWorker() throws IOException { String workerScript = readResource("/static/pdfjs/build/pdf.worker.mjs"); - assert workerScript.contains("import \"../web/compatibility.mjs\";"); + assertTrue(workerScript.contains("import \"../web/compatibility.mjs\";")); } private String readResource(String resourcePath) throws IOException { try (InputStream inputStream = getClass().getResourceAsStream(resourcePath)) { - assert inputStream != null; + assertNotNull(inputStream); return new String(inputStream.readAllBytes(), StandardCharsets.UTF_8); } }