fix: checkstyle error. (#1375)

pull/1376/head^2
Ryan Wang 2021-05-16 17:03:58 +08:00 committed by GitHub
parent 15381e655e
commit a2c9e42970
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 33 additions and 29 deletions

View File

@ -11,9 +11,9 @@ import run.halo.app.utils.MarkdownUtils;
@Slf4j
public class HTMLWordCountTest {
String markdownWithPicture = "图片字数测试\n" +
"![image.png](http://127.0.0.1:8090/upload/2021/04/image-51142fdc369c48698dd75c24f6049738" +
".png)";
String markdownWithPicture = "图片字数测试\n"
+ "![image.png](http://127.0.0.1:8090/upload/2021/04/image-51142fdc369c48698dd75c24f6049738"
+ ".png)";
String markdownWithTitle = "# 标题字数测试";
@ -23,35 +23,37 @@ public class HTMLWordCountTest {
String markdownWithLink = "[链接字数测试](https://www.baidu.com)";
String markdownWithTable =
"|表格|字数|测试|\n" +
"|-------|-------|-------|\n" +
"|表格|字数|测试|\n";
String markdownWithTable = "|表格|字数|测试|\n"
+ "|-------|-------|-------|\n"
+ "|表格|字数|测试|\n";
String plainText = "纯文本字数测试";
String complexText = "# 复杂文本测试\n\n" +
"![图片不算字数](http://127.0.0.1:8090/upload/2021/04/image-51142fdc369c48698dd75c24f6049738)\n\n" +
"++~~***复杂文本测试***~~++ `复杂文本测试` [复杂文本测试](https://halo.run)\n\n" +
"|复杂|文本|测试|\n" +
"|-------|-------|-------|\n" +
"|复杂|文本|测试|\n\n" +
"## 复杂文本测试\n";
String complexText = "# 复杂文本测试\n\n"
+ "![图片不算字数](http://127.0.0.1:8090/upload/2021/04/image-51142fdc369c48698dd75c24f6049738)"
+ "\n\n"
+ "++~~***复杂文本测试***~~++ `复杂文本测试` [复杂文本测试](https://halo.run)\n\n"
+ "|复杂|文本|测试|\n"
+ "|-------|-------|-------|\n"
+ "|复杂|文本|测试|\n\n"
+ "## 复杂文本测试\n";
String htmlText =
"<body><h1>复杂文本测试 </h1>\n" +
"<p><img src=\"http://127.0.0.1:8090/upload/2021/04/image-51142fdc369c48698dd75c24f6049738\" " +
"referrerpolicy=\"no-referrer\" alt=\"图片不算字数\"> \n" +
"<del><strong><em>复杂文本测试</em></strong></del> <code>复杂文本测试</code> <a href='https://halo" +
".run'>复杂文本测试</a> </p>\n" +
"<figure><table>\n" +
"<thead>\n" +
"<tr><th>复杂</th><th>文本</th><th>测试</th></tr></thead>\n" +
"<tbody><tr><td>复杂</td><td>文本</td><td>测试</td></tr></tbody>\n" +
"</table></figure>\n" +
"<h2>复杂文本测试</h2>\n" +
"</body>\n" +
"</html>";
"<body><h1>复杂文本测试 </h1>\n"
+ "<p><img src=\"http://127.0.0"
+ ".1:8090/upload/2021/04/image-51142fdc369c48698dd75c24f6049738\" "
+ "referrerpolicy=\"no-referrer\" alt=\"图片不算字数\"> \n"
+ "<del><strong><em>复杂文本测试</em></strong></del> <code>复杂文本测试</code> <a "
+ "href='https://halo"
+ ".run'>复杂文本测试</a> </p>\n"
+ "<figure><table>\n"
+ "<thead>\n"
+ "<tr><th>复杂</th><th>文本</th><th>测试</th></tr></thead>\n"
+ "<tbody><tr><td>复杂</td><td>文本</td><td>测试</td></tr></tbody>\n"
+ "</table></figure>\n"
+ "<h2>复杂文本测试</h2>\n"
+ "</body>\n"
+ "</html>";
String nullString = null;
@ -72,13 +74,15 @@ public class HTMLWordCountTest {
@Test
void fontTypeTest() {
assertEquals("字体样式字数测试".length(),
BasePostServiceImpl.htmlFormatWordCount(MarkdownUtils.renderHtml(markdownWithFontType)));
BasePostServiceImpl
.htmlFormatWordCount(MarkdownUtils.renderHtml(markdownWithFontType)));
}
@Test
void codeTypeTest() {
assertEquals("代码样式字数测试".length(),
BasePostServiceImpl.htmlFormatWordCount(MarkdownUtils.renderHtml(markdownWithCodeType)));
BasePostServiceImpl
.htmlFormatWordCount(MarkdownUtils.renderHtml(markdownWithCodeType)));
}
@Test