mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-08-18 20:38:02 +08:00
单元测试由Junit4变更为Junit5
This commit is contained in:
@@ -27,7 +27,7 @@
|
||||
<thymeleaf.version>3.1.2.RELEASE</thymeleaf.version>
|
||||
<mail.version>1.6.2</mail.version>
|
||||
<jsch.version>0.1.55</jsch.version>
|
||||
<sshj.version>0.37.0</sshj.version>
|
||||
<sshj.version>0.38.0</sshj.version>
|
||||
<zxing.version>3.5.3</zxing.version>
|
||||
<net.version>3.9.0</net.version>
|
||||
<emoji-java.version>5.1.1</emoji-java.version>
|
||||
@@ -145,14 +145,14 @@
|
||||
<dependency>
|
||||
<groupId>jakarta.mail</groupId>
|
||||
<artifactId>jakarta.mail-api</artifactId>
|
||||
<version>2.1.2</version>
|
||||
<version>2.1.3</version>
|
||||
<scope>compile</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.angus</groupId>
|
||||
<artifactId>jakarta.mail</artifactId>
|
||||
<version>2.0.2</version>
|
||||
<version>2.0.3</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
@@ -420,7 +420,7 @@
|
||||
<dependency>
|
||||
<groupId>com.googlecode.aviator</groupId>
|
||||
<artifactId>aviator</artifactId>
|
||||
<version>5.4.1</version>
|
||||
<version>5.4.3</version>
|
||||
<scope>compile</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
@@ -469,7 +469,7 @@
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>QLExpress</artifactId>
|
||||
<version>3.3.2</version>
|
||||
<version>3.3.3</version>
|
||||
<scope>compile</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
@@ -2,8 +2,8 @@ package cn.hutool.extra.cglib;
|
||||
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import lombok.Data;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class CglibUtilTest {
|
||||
|
||||
@@ -15,20 +15,20 @@ public class CglibUtilTest {
|
||||
bean.setValue2("123");
|
||||
|
||||
CglibUtil.copy(bean, otherBean);
|
||||
Assert.assertEquals("Hello world", otherBean.getValue());
|
||||
assertEquals("Hello world", otherBean.getValue());
|
||||
// 无定义转换器,转换失败
|
||||
Assert.assertEquals(0, otherBean.getValue2());
|
||||
assertEquals(0, otherBean.getValue2());
|
||||
|
||||
OtherSampleBean otherBean2 = CglibUtil.copy(bean, OtherSampleBean.class);
|
||||
Assert.assertEquals("Hello world", otherBean2.getValue());
|
||||
assertEquals("Hello world", otherBean2.getValue());
|
||||
// 无定义转换器,转换失败
|
||||
Assert.assertEquals(0, otherBean.getValue2());
|
||||
assertEquals(0, otherBean.getValue2());
|
||||
|
||||
otherBean = new OtherSampleBean();
|
||||
//自定义转换器
|
||||
CglibUtil.copy(bean, otherBean, (value, target, context) -> Convert.convertQuietly(target, value));
|
||||
Assert.assertEquals("Hello world", otherBean.getValue());
|
||||
Assert.assertEquals(123, otherBean.getValue2());
|
||||
assertEquals("Hello world", otherBean.getValue());
|
||||
assertEquals(123, otherBean.getValue2());
|
||||
}
|
||||
|
||||
@Data
|
||||
|
@@ -5,8 +5,8 @@ import cn.hutool.core.lang.Console;
|
||||
import cn.hutool.core.util.CharsetUtil;
|
||||
import cn.hutool.extra.compress.archiver.StreamArchiver;
|
||||
import org.apache.commons.compress.archivers.ArchiveStreamFactory;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
@@ -14,7 +14,7 @@ import java.io.File;
|
||||
public class ArchiverTest {
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void zipTest(){
|
||||
final File file = FileUtil.file("d:/test/compress/test.zip");
|
||||
StreamArchiver.create(CharsetUtil.CHARSET_UTF_8, ArchiveStreamFactory.ZIP, file)
|
||||
@@ -26,7 +26,7 @@ public class ArchiverTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void tarTest(){
|
||||
final File file = FileUtil.file("d:/test/compress/test.tar");
|
||||
StreamArchiver.create(CharsetUtil.CHARSET_UTF_8, ArchiveStreamFactory.TAR, file)
|
||||
@@ -38,7 +38,7 @@ public class ArchiverTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void cpioTest(){
|
||||
final File file = FileUtil.file("d:/test/compress/test.cpio");
|
||||
StreamArchiver.create(CharsetUtil.CHARSET_UTF_8, ArchiveStreamFactory.CPIO, file)
|
||||
@@ -50,7 +50,7 @@ public class ArchiverTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void sevenZTest(){
|
||||
final File file = FileUtil.file("d:/test/compress/test.7z");
|
||||
CompressUtil.createArchiver(CharsetUtil.CHARSET_UTF_8, ArchiveStreamFactory.SEVEN_Z, file)
|
||||
@@ -62,7 +62,7 @@ public class ArchiverTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void tgzTest(){
|
||||
final File file = FileUtil.file("d:/test/compress/test.tgz");
|
||||
CompressUtil.createArchiver(CharsetUtil.CHARSET_UTF_8, "tgz", file)
|
||||
@@ -82,7 +82,7 @@ public class ArchiverTest {
|
||||
* Add: D:\disk-all\新建文件夹
|
||||
*/
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void emptyTest(){
|
||||
final File file = FileUtil.file("d:/disk-all.tgz");
|
||||
CompressUtil.createArchiver(CharsetUtil.CHARSET_UTF_8, "tgz", file)
|
||||
@@ -94,7 +94,7 @@ public class ArchiverTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void emptyZTest(){
|
||||
final File file = FileUtil.file("d:/disk-all.7z");
|
||||
CompressUtil.createArchiver(CharsetUtil.CHARSET_UTF_8, "7z", file)
|
||||
|
@@ -3,15 +3,15 @@ package cn.hutool.extra.compress;
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import cn.hutool.core.util.CharsetUtil;
|
||||
import cn.hutool.extra.compress.extractor.Extractor;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public class ExtractorTest {
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void zipTest() {
|
||||
final Extractor extractor = CompressUtil.createExtractor(
|
||||
CharsetUtil.defaultCharset(),
|
||||
@@ -21,7 +21,7 @@ public class ExtractorTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void sevenZTest() {
|
||||
final Extractor extractor = CompressUtil.createExtractor(
|
||||
CharsetUtil.defaultCharset(),
|
||||
@@ -31,7 +31,7 @@ public class ExtractorTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void tgzTest() {
|
||||
final Extractor extractor = CompressUtil.createExtractor(
|
||||
CharsetUtil.defaultCharset(),
|
||||
@@ -42,7 +42,7 @@ public class ExtractorTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void sevenZTest2() {
|
||||
final File targetDir = FileUtil.file("d:/test/sevenZ2/");
|
||||
FileUtil.clean(targetDir);
|
||||
@@ -55,7 +55,7 @@ public class ExtractorTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void zipTest2() {
|
||||
final File targetDir = FileUtil.file("d:/test/zip2/");
|
||||
FileUtil.clean(targetDir);
|
||||
|
@@ -14,8 +14,8 @@ package cn.hutool.extra.compress;
|
||||
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import org.apache.commons.compress.archivers.ArchiveStreamFactory;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
@@ -23,7 +23,7 @@ import java.nio.charset.StandardCharsets;
|
||||
public class IssueI7PMJ0Test {
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void createArchiverTest() {
|
||||
final File tarFile = FileUtil.file("d:/test/issueI7PMJ0.zip");
|
||||
CompressUtil.createArchiver(StandardCharsets.UTF_8, ArchiveStreamFactory.ZIP, tarFile)
|
||||
|
@@ -1,28 +1,28 @@
|
||||
package cn.hutool.extra.emoji;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class EmojiUtilTest {
|
||||
|
||||
|
||||
@Test
|
||||
public void toUnicodeTest() {
|
||||
String emoji = EmojiUtil.toUnicode(":smile:");
|
||||
Assert.assertEquals("😄", emoji);
|
||||
assertEquals("😄", emoji);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void toAliasTest() {
|
||||
String alias = EmojiUtil.toAlias("😄");
|
||||
Assert.assertEquals(":smile:", alias);
|
||||
assertEquals(":smile:", alias);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void containsEmojiTest() {
|
||||
boolean containsEmoji = EmojiUtil.containsEmoji("测试一下是否包含EMOJ:😄");
|
||||
Assert.assertTrue(containsEmoji);
|
||||
assertTrue(containsEmoji);
|
||||
boolean notContainsEmoji = EmojiUtil.containsEmoji("不包含EMOJ:^_^");
|
||||
Assert.assertFalse(notContainsEmoji);
|
||||
assertFalse(notContainsEmoji);
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -5,8 +5,8 @@ import cn.hutool.core.lang.Console;
|
||||
import cn.hutool.core.lang.Dict;
|
||||
import cn.hutool.extra.expression.engine.aviator.AviatorEngine;
|
||||
import lombok.Data;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@@ -22,19 +22,19 @@ public class AviatorTest {
|
||||
String exp =
|
||||
"\"[foo i=\"+ foo.i + \", f=\" + foo.f + \", date.year=\" + (foo.date.year+1900) + \", date.month=\" + foo.date.month + \", bars[0].name=\" + #foo.bars[0].name + \"]\"";
|
||||
String result = (String) engine.eval(exp, Dict.create().set("foo", foo), null);
|
||||
Assert.assertEquals("[foo i=100, f=3.14, date.year=2020, date.month=10, bars[0].name=bar]", result);
|
||||
assertEquals("[foo i=100, f=3.14, date.year=2020, date.month=10, bars[0].name=bar]", result);
|
||||
|
||||
// Assignment.
|
||||
exp = "#foo.bars[0].name='hello aviator' ; #foo.bars[0].name";
|
||||
result = (String) engine.eval(exp, Dict.create().set("foo", foo), null);
|
||||
Assert.assertEquals("hello aviator", result);
|
||||
Assert.assertEquals("hello aviator", foo.bars[0].getName());
|
||||
assertEquals("hello aviator", result);
|
||||
assertEquals("hello aviator", foo.bars[0].getName());
|
||||
|
||||
exp = "foo.bars[0] = nil ; foo.bars[0]";
|
||||
result = (String) engine.eval(exp, Dict.create().set("foo", foo), null);
|
||||
Console.log("Execute expression: " + exp);
|
||||
Assert.assertNull(result);
|
||||
Assert.assertNull(foo.bars[0]);
|
||||
assertNull(result);
|
||||
assertNull(foo.bars[0]);
|
||||
}
|
||||
|
||||
@Data
|
||||
|
@@ -7,8 +7,8 @@ import cn.hutool.extra.expression.engine.mvel.MvelEngine;
|
||||
import cn.hutool.extra.expression.engine.qlexpress.QLExpressEngine;
|
||||
import cn.hutool.extra.expression.engine.rhino.RhinoEngine;
|
||||
import cn.hutool.extra.expression.engine.spel.SpELEngine;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
@@ -22,7 +22,7 @@ public class ExpressionUtilTest {
|
||||
.set("b", 45)
|
||||
.set("c", -199.100);
|
||||
final Object eval = ExpressionUtil.eval("a-(b-c)", dict);
|
||||
Assert.assertEquals(-143.8, (double)eval, 0);
|
||||
assertEquals(-143.8, (double)eval, 0);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -34,7 +34,7 @@ public class ExpressionUtilTest {
|
||||
.set("b", 45)
|
||||
.set("c", -199.100);
|
||||
final Object eval = engine.eval("a-(b-c)", dict, null);
|
||||
Assert.assertEquals(-143.8, (double)eval, 0);
|
||||
assertEquals(-143.8, (double)eval, 0);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -45,7 +45,7 @@ public class ExpressionUtilTest {
|
||||
final Map<String,Object> map2=new HashMap<>();
|
||||
map2.put("a", 1);
|
||||
final Object eval1 = engine.eval(exps2, map2, null);
|
||||
Assert.assertEquals(100, eval1);
|
||||
assertEquals(100, eval1);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -57,7 +57,7 @@ public class ExpressionUtilTest {
|
||||
.set("b", 45)
|
||||
.set("c", -199.100);
|
||||
final Object eval = engine.eval("a-(b-c)", dict, null);
|
||||
Assert.assertEquals(-143.8, (double)eval, 0);
|
||||
assertEquals(-143.8, (double)eval, 0);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -69,7 +69,7 @@ public class ExpressionUtilTest {
|
||||
.set("b", 45)
|
||||
.set("c", -199.100);
|
||||
final Object eval = engine.eval("a-(b-c)", dict, null);
|
||||
Assert.assertEquals(-143.8, (double)eval, 0);
|
||||
assertEquals(-143.8, (double)eval, 0);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -81,7 +81,7 @@ public class ExpressionUtilTest {
|
||||
.set("b", 45)
|
||||
.set("c", -199.100);
|
||||
final Object eval = engine.eval("#a-(#b-#c)", dict, null);
|
||||
Assert.assertEquals(-143.8, (double)eval, 0);
|
||||
assertEquals(-143.8, (double)eval, 0);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -93,7 +93,7 @@ public class ExpressionUtilTest {
|
||||
.set("b", 45)
|
||||
.set("c", -199.100);
|
||||
final Object eval = engine.eval("a-(b-c)", dict, null);
|
||||
Assert.assertEquals(-143.8, (double)eval, 0);
|
||||
assertEquals(-143.8, (double)eval, 0);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -105,7 +105,7 @@ public class ExpressionUtilTest {
|
||||
.set("b", 45)
|
||||
.set("c", -199.100);
|
||||
final Object eval = engine.eval("a-(b-c)", dict, null);
|
||||
Assert.assertEquals(-143.8, (double)eval, 0);
|
||||
assertEquals(-143.8, (double)eval, 0);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -6,8 +6,8 @@ import cn.hutool.core.io.IoUtil;
|
||||
import cn.hutool.core.lang.Console;
|
||||
import cn.hutool.extra.ssh.Sftp;
|
||||
import org.apache.commons.net.ftp.FTPFile;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
@@ -16,7 +16,7 @@ import java.util.List;
|
||||
public class FtpTest {
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void cdTest() {
|
||||
final Ftp ftp = new Ftp("looly.centos");
|
||||
|
||||
@@ -27,7 +27,7 @@ public class FtpTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void uploadTest() {
|
||||
final Ftp ftp = new Ftp("localhost");
|
||||
|
||||
@@ -38,7 +38,7 @@ public class FtpTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void uploadDirectorTest() {
|
||||
final Ftp ftp = new Ftp("localhost");
|
||||
|
||||
@@ -47,7 +47,7 @@ public class FtpTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void reconnectIfTimeoutTest() throws InterruptedException {
|
||||
final Ftp ftp = new Ftp("looly.centos");
|
||||
|
||||
@@ -71,7 +71,7 @@ public class FtpTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void recursiveDownloadFolder() {
|
||||
final Ftp ftp = new Ftp("looly.centos");
|
||||
ftp.recursiveDownloadFolder("/",FileUtil.file("d:/test/download"));
|
||||
@@ -80,7 +80,7 @@ public class FtpTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void recursiveDownloadFolderSftp() {
|
||||
final Sftp ftp = new Sftp("127.0.0.1", 22, "test", "test");
|
||||
|
||||
@@ -92,7 +92,7 @@ public class FtpTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void downloadTest() {
|
||||
String downloadPath = "d:/test/download/";
|
||||
try (final Ftp ftp = new Ftp("localhost")) {
|
||||
@@ -114,7 +114,7 @@ public class FtpTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void isDirTest() throws Exception {
|
||||
try (final Ftp ftp = new Ftp("127.0.0.1", 21)) {
|
||||
Console.log(ftp.pwd());
|
||||
@@ -124,7 +124,7 @@ public class FtpTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void existSftpTest() throws Exception {
|
||||
try (final Sftp ftp = new Sftp("127.0.0.1", 22, "test", "test")) {
|
||||
Console.log(ftp.pwd());
|
||||
@@ -147,7 +147,7 @@ public class FtpTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void existFtpTest() throws Exception {
|
||||
try (final Ftp ftp = new Ftp("127.0.0.1", 21)) {
|
||||
Console.log(ftp.pwd());
|
||||
|
@@ -1,9 +1,9 @@
|
||||
package cn.hutool.extra.mail;
|
||||
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.util.HashMap;
|
||||
@@ -18,20 +18,20 @@ import java.util.Properties;
|
||||
public class JakartaMailTest {
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void sendWithFileTest() {
|
||||
JakartaMailUtil.send("hutool@foxmail.com", "测试", "<h1>邮件来自Hutool测试</h1>", true, FileUtil.file("d:/测试附件文本.txt"));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void sendWithLongNameFileTest() {
|
||||
//附件名长度大于60时的测试
|
||||
JakartaMailUtil.send("hutool@foxmail.com", "测试", "<h1>邮件来自Hutool测试</h1>", true, FileUtil.file("d:/6-LongLong一阶段平台建设周报2018.3.12-3.16.xlsx"));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void sendWithImageTest() {
|
||||
Map<String, InputStream> map = new HashMap<>();
|
||||
map.put("testImage", FileUtil.getInputStream("f:/test/me.png"));
|
||||
@@ -39,13 +39,13 @@ public class JakartaMailTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void sendHtmlTest() {
|
||||
JakartaMailUtil.send("hutool@foxmail.com", "测试", "<h1>邮件来自Hutool测试</h1>", true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void sendByAccountTest() {
|
||||
MailAccount account = new MailAccount();
|
||||
account.setHost("smtp.yeah.net");
|
||||
@@ -64,6 +64,6 @@ public class JakartaMailTest {
|
||||
account.setDebug(true);
|
||||
account.defaultIfEmpty();
|
||||
Properties props = account.getSmtpProps();
|
||||
Assert.assertEquals("true", props.getProperty("mail.debug"));
|
||||
assertEquals("true", props.getProperty("mail.debug"));
|
||||
}
|
||||
}
|
||||
|
@@ -1,9 +1,9 @@
|
||||
package cn.hutool.extra.mail;
|
||||
|
||||
import com.sun.mail.util.MailSSLSocketFactory;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.security.GeneralSecurityException;
|
||||
|
||||
@@ -19,8 +19,8 @@ public class MailAccountTest {
|
||||
MailAccount account = GlobalMailAccount.INSTANCE.getAccount();
|
||||
account.getSmtpProps();
|
||||
|
||||
Assert.assertNotNull(account.getCharset());
|
||||
Assert.assertTrue(account.isSslEnable());
|
||||
assertNotNull(account.getCharset());
|
||||
assertTrue(account.isSslEnable());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -31,7 +31,7 @@ public class MailAccountTest {
|
||||
* 已经测试通过
|
||||
*/
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void customPropertyTest() throws GeneralSecurityException {
|
||||
MailAccount mailAccount = new MailAccount();
|
||||
mailAccount.setFrom("xxx@xxx.com");
|
||||
|
@@ -1,9 +1,9 @@
|
||||
package cn.hutool.extra.mail;
|
||||
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.util.HashMap;
|
||||
@@ -18,20 +18,20 @@ import java.util.Properties;
|
||||
public class MailTest {
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void sendWithFileTest() {
|
||||
MailUtil.send("hutool@foxmail.com", "测试", "<h1>邮件来自Hutool测试</h1>", true, FileUtil.file("d:/测试附件文本.txt"));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void sendWithLongNameFileTest() {
|
||||
//附件名长度大于60时的测试
|
||||
MailUtil.send("hutool@foxmail.com", "测试", "<h1>邮件来自Hutool测试</h1>", true, FileUtil.file("d:/6-LongLong一阶段平台建设周报2018.3.12-3.16.xlsx"));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void sendWithImageTest() {
|
||||
Map<String, InputStream> map = new HashMap<>();
|
||||
map.put("testImage", FileUtil.getInputStream("f:/test/me.png"));
|
||||
@@ -39,13 +39,13 @@ public class MailTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void sendHtmlTest() {
|
||||
MailUtil.send("hutool@foxmail.com", "测试", "<h1>邮件来自Hutool测试</h1>", true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void sendByAccountTest() {
|
||||
MailAccount account = new MailAccount();
|
||||
account.setHost("smtp.yeah.net");
|
||||
@@ -64,6 +64,6 @@ public class MailTest {
|
||||
account.setDebug(true);
|
||||
account.defaultIfEmpty();
|
||||
Properties props = account.getSmtpProps();
|
||||
Assert.assertEquals("true", props.getProperty("mail.debug"));
|
||||
assertEquals("true", props.getProperty("mail.debug"));
|
||||
}
|
||||
}
|
||||
|
@@ -1,8 +1,8 @@
|
||||
package cn.hutool.extra.pinyin;
|
||||
|
||||
import cn.hutool.extra.pinyin.engine.bopomofo4j.Bopomofo4jEngine;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class Bopomofo4jTest {
|
||||
|
||||
@@ -11,13 +11,13 @@ public class Bopomofo4jTest {
|
||||
@Test
|
||||
public void getFirstLetterByBopomofo4jTest(){
|
||||
final String result = engine.getFirstLetter("林海", "");
|
||||
Assert.assertEquals("lh", result);
|
||||
assertEquals("lh", result);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getPinyinByBopomofo4jTest() {
|
||||
final String pinyin = engine.getPinyin("你好h", " ");
|
||||
Assert.assertEquals("ni haoh", pinyin);
|
||||
assertEquals("ni haoh", pinyin);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -1,8 +1,8 @@
|
||||
package cn.hutool.extra.pinyin;
|
||||
|
||||
import cn.hutool.extra.pinyin.engine.houbbpinyin.HoubbPinyinEngine;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class HoubbPinyinTest {
|
||||
|
||||
@@ -11,12 +11,12 @@ public class HoubbPinyinTest {
|
||||
@Test
|
||||
public void getFirstLetterTest(){
|
||||
final String result = engine.getFirstLetter("林海", "");
|
||||
Assert.assertEquals("lh", result);
|
||||
assertEquals("lh", result);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getPinyinTest() {
|
||||
final String pinyin = engine.getPinyin("你好h", " ");
|
||||
Assert.assertEquals("ni hao h", pinyin);
|
||||
assertEquals("ni hao h", pinyin);
|
||||
}
|
||||
}
|
||||
|
@@ -1,8 +1,8 @@
|
||||
package cn.hutool.extra.pinyin;
|
||||
|
||||
import cn.hutool.extra.pinyin.engine.jpinyin.JPinyinEngine;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class JpinyinTest {
|
||||
|
||||
@@ -11,13 +11,13 @@ public class JpinyinTest {
|
||||
@Test
|
||||
public void getFirstLetterByPinyin4jTest(){
|
||||
final String result = engine.getFirstLetter("林海", "");
|
||||
Assert.assertEquals("lh", result);
|
||||
assertEquals("lh", result);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getPinyinByPinyin4jTest() {
|
||||
final String pinyin = engine.getPinyin("你好h", " ");
|
||||
Assert.assertEquals("ni hao h", pinyin);
|
||||
assertEquals("ni hao h", pinyin);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -1,8 +1,8 @@
|
||||
package cn.hutool.extra.pinyin;
|
||||
|
||||
import cn.hutool.extra.pinyin.engine.pinyin4j.Pinyin4jEngine;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class Pinyin4jTest {
|
||||
|
||||
@@ -11,12 +11,12 @@ public class Pinyin4jTest {
|
||||
@Test
|
||||
public void getFirstLetterByPinyin4jTest(){
|
||||
final String result = engine.getFirstLetter("林海", "");
|
||||
Assert.assertEquals("lh", result);
|
||||
assertEquals("lh", result);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getPinyinByPinyin4jTest() {
|
||||
final String pinyin = engine.getPinyin("你好h", " ");
|
||||
Assert.assertEquals("ni hao h", pinyin);
|
||||
assertEquals("ni hao h", pinyin);
|
||||
}
|
||||
}
|
||||
|
@@ -1,25 +1,25 @@
|
||||
package cn.hutool.extra.pinyin;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class PinyinUtilTest {
|
||||
|
||||
@Test
|
||||
public void getPinyinTest(){
|
||||
final String pinyin = PinyinUtil.getPinyin("你好怡", " ");
|
||||
Assert.assertEquals("ni hao yi", pinyin);
|
||||
assertEquals("ni hao yi", pinyin);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getFirstLetterTest(){
|
||||
final String result = PinyinUtil.getFirstLetter("H是第一个", ", ");
|
||||
Assert.assertEquals("h, s, d, y, g", result);
|
||||
assertEquals("h, s, d, y, g", result);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getFirstLetterTest2(){
|
||||
final String result = PinyinUtil.getFirstLetter("崞阳", ", ");
|
||||
Assert.assertEquals("g, y", result);
|
||||
assertEquals("g, y", result);
|
||||
}
|
||||
}
|
||||
|
@@ -1,8 +1,8 @@
|
||||
package cn.hutool.extra.pinyin;
|
||||
|
||||
import cn.hutool.extra.pinyin.engine.tinypinyin.TinyPinyinEngine;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class TinyPinyinTest {
|
||||
|
||||
@@ -11,12 +11,12 @@ public class TinyPinyinTest {
|
||||
@Test
|
||||
public void getFirstLetterByPinyin4jTest(){
|
||||
final String result = engine.getFirstLetter("林海", "");
|
||||
Assert.assertEquals("lh", result);
|
||||
assertEquals("lh", result);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getPinyinByPinyin4jTest() {
|
||||
final String pinyin = engine.getPinyin("你好h", " ");
|
||||
Assert.assertEquals("ni hao h", pinyin);
|
||||
assertEquals("ni hao h", pinyin);
|
||||
}
|
||||
}
|
||||
|
@@ -15,8 +15,8 @@ package cn.hutool.extra.qrcode;
|
||||
import cn.hutool.core.img.ImgUtil;
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import cn.hutool.core.lang.Console;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.io.File;
|
||||
@@ -24,7 +24,7 @@ import java.io.File;
|
||||
public class IssueI7RUIVTest {
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void generateTest() {
|
||||
final QrConfig config = new QrConfig(300, 300);
|
||||
|
||||
|
@@ -7,8 +7,8 @@ import cn.hutool.core.lang.Assert;
|
||||
import com.google.zxing.BarcodeFormat;
|
||||
import com.google.zxing.datamatrix.encoder.SymbolShapeHint;
|
||||
import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.image.BufferedImage;
|
||||
@@ -31,7 +31,7 @@ public class QrCodeUtilTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void generateCustomTest() {
|
||||
final QrConfig config = new QrConfig();
|
||||
config.setMargin(0);
|
||||
@@ -43,7 +43,7 @@ public class QrCodeUtilTest {
|
||||
QrCodeUtil.generate("https://hutool.cn/", config, FileUtil.touch(path));
|
||||
}
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void generateNoCustomColorTest() {
|
||||
final QrConfig config = new QrConfig();
|
||||
config.setMargin(0);
|
||||
@@ -56,7 +56,7 @@ public class QrCodeUtilTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void generateWithLogoTest() {
|
||||
final String icon = FileUtil.isWindows() ? "d:/test/pic/face.jpg" : "~/Desktop/hutool/pic/face.jpg";
|
||||
final String targetPath = FileUtil.isWindows() ? "d:/test/qrcodeWithLogo.jpg" : "~/Desktop/hutool/qrcodeWithLogo.jpg";
|
||||
@@ -67,14 +67,14 @@ public class QrCodeUtilTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void decodeTest() {
|
||||
final String decode = QrCodeUtil.decode(FileUtil.file("d:/test/pic/qr.png"));
|
||||
//Console.log(decode);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void decodeTest2() {
|
||||
// 条形码
|
||||
final String decode = QrCodeUtil.decode(FileUtil.file("d:/test/90.png"));
|
||||
@@ -88,7 +88,7 @@ public class QrCodeUtilTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void generateAsBase64Test2() {
|
||||
final byte[] bytes = FileUtil.readBytes(
|
||||
new File("d:/test/qr.png"));
|
||||
@@ -105,7 +105,7 @@ public class QrCodeUtilTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void decodeTest3() {
|
||||
final String decode = QrCodeUtil.decode(ImgUtil.read("d:/test/qr_a.png"), false, true);
|
||||
//Console.log(decode);
|
||||
@@ -130,7 +130,7 @@ public class QrCodeUtilTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void generateSvgTest() {
|
||||
final QrConfig qrConfig = QrConfig.create()
|
||||
.setImg("d:/test/logo.png")
|
||||
@@ -170,7 +170,7 @@ public class QrCodeUtilTest {
|
||||
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void generateToFileTest() {
|
||||
final QrConfig qrConfig = QrConfig.create()
|
||||
.setForeColor(Color.BLUE)
|
||||
@@ -183,7 +183,7 @@ public class QrCodeUtilTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void generateToStreamTest() {
|
||||
final QrConfig qrConfig = QrConfig.create()
|
||||
.setForeColor(Color.BLUE)
|
||||
@@ -201,7 +201,7 @@ public class QrCodeUtilTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void comparePngAndSvgAndAsciiArtTest() {
|
||||
final QrConfig qrConfig = QrConfig.create()
|
||||
.setForeColor(null)
|
||||
|
@@ -1,8 +1,8 @@
|
||||
package cn.hutool.extra.servlet;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.ByteArrayInputStream;
|
||||
@@ -18,7 +18,7 @@ import java.nio.charset.StandardCharsets;
|
||||
public class ServletUtilTest {
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void writeTest() {
|
||||
HttpServletResponse response = null;
|
||||
byte[] bytes = StrUtil.utf8Bytes("地球是我们共同的家园,需要大家珍惜.");
|
||||
@@ -35,7 +35,7 @@ public class ServletUtilTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void jakartaWriteTest() {
|
||||
jakarta.servlet.http.HttpServletResponse response = null;
|
||||
byte[] bytes = StrUtil.utf8Bytes("地球是我们共同的家园,需要大家珍惜.");
|
||||
|
@@ -1,7 +1,7 @@
|
||||
package cn.hutool.extra.spring;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
@@ -17,8 +17,8 @@ public class EnableSpringUtilTest {
|
||||
@Test
|
||||
public void test() {
|
||||
// 使用@EnableSpringUtil注解后, 能获取上下文
|
||||
Assert.assertNotNull(SpringUtil.getApplicationContext());
|
||||
assertNotNull(SpringUtil.getApplicationContext());
|
||||
// 不使用时, 为null
|
||||
// Assert.assertNull(SpringUtil.getApplicationContext());
|
||||
// assertNull(SpringUtil.getApplicationContext());
|
||||
}
|
||||
}
|
||||
|
@@ -3,8 +3,8 @@ package cn.hutool.extra.spring;
|
||||
import cn.hutool.core.lang.TypeReference;
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import lombok.Data;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -32,8 +32,8 @@ public class SpringUtilTest {
|
||||
SpringUtil.registerBean("registerBean", registerBean);
|
||||
|
||||
Demo2 registerBean2 = SpringUtil.getBean("registerBean");
|
||||
Assert.assertEquals(123, registerBean2.getId());
|
||||
Assert.assertEquals("222", registerBean2.getName());
|
||||
assertEquals(123, registerBean2.getId());
|
||||
assertEquals("222", registerBean2.getName());
|
||||
|
||||
|
||||
}
|
||||
@@ -44,12 +44,12 @@ public class SpringUtilTest {
|
||||
@Test
|
||||
public void unregisterBeanTest() {
|
||||
registerTestAutoWired();
|
||||
Assert.assertNotNull(SpringUtil.getBean("testAutoWired"));
|
||||
assertNotNull(SpringUtil.getBean("testAutoWired"));
|
||||
SpringUtil.unregisterBean("testAutoWired1");
|
||||
try {
|
||||
SpringUtil.getBean("testAutoWired");
|
||||
} catch (NoSuchBeanDefinitionException e) {
|
||||
Assert.assertEquals(e.getClass(), NoSuchBeanDefinitionException.class);
|
||||
assertEquals(e.getClass(), NoSuchBeanDefinitionException.class);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,26 +64,26 @@ public class SpringUtilTest {
|
||||
SpringUtil.registerBean("testAutoWired", testAutoWired);
|
||||
|
||||
testAutoWired = SpringUtil.getBean("testAutoWired");
|
||||
Assert.assertNotNull(testAutoWired);
|
||||
Assert.assertNotNull(testAutoWired.getAutowiredBean());
|
||||
Assert.assertNotNull(testAutoWired.getResourceBean());
|
||||
Assert.assertEquals("123", testAutoWired.getAutowiredBean().getId());
|
||||
assertNotNull(testAutoWired);
|
||||
assertNotNull(testAutoWired.getAutowiredBean());
|
||||
assertNotNull(testAutoWired.getResourceBean());
|
||||
assertEquals("123", testAutoWired.getAutowiredBean().getId());
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getBeanTest(){
|
||||
final Demo2 testDemo = SpringUtil.getBean("testDemo");
|
||||
Assert.assertEquals(12345, testDemo.getId());
|
||||
Assert.assertEquals("test", testDemo.getName());
|
||||
assertEquals(12345, testDemo.getId());
|
||||
assertEquals("test", testDemo.getName());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getBeanWithTypeReferenceTest() {
|
||||
Map<String, Object> mapBean = SpringUtil.getBean(new TypeReference<Map<String, Object>>() {});
|
||||
Assert.assertNotNull(mapBean);
|
||||
Assert.assertEquals("value1", mapBean.get("key1"));
|
||||
Assert.assertEquals("value2", mapBean.get("key2"));
|
||||
assertNotNull(mapBean);
|
||||
assertEquals("value1", mapBean.get("key1"));
|
||||
assertEquals("value2", mapBean.get("key2"));
|
||||
}
|
||||
|
||||
@Data
|
||||
|
@@ -3,8 +3,8 @@ package cn.hutool.extra.spring;
|
||||
import cn.hutool.core.lang.TypeReference;
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import lombok.Data;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
@@ -31,23 +31,23 @@ public class SpringUtilWithAutoConfigTest {
|
||||
SpringUtil.registerBean("registerBean", registerBean);
|
||||
|
||||
Demo2 registerBean2 = SpringUtil.getBean("registerBean");
|
||||
Assert.assertEquals(123, registerBean2.getId());
|
||||
Assert.assertEquals("222", registerBean2.getName());
|
||||
assertEquals(123, registerBean2.getId());
|
||||
assertEquals("222", registerBean2.getName());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getBeanTest(){
|
||||
final Demo2 testDemo = SpringUtil.getBean("testDemo");
|
||||
Assert.assertEquals(12345, testDemo.getId());
|
||||
Assert.assertEquals("test", testDemo.getName());
|
||||
assertEquals(12345, testDemo.getId());
|
||||
assertEquals("test", testDemo.getName());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getBeanWithTypeReferenceTest() {
|
||||
Map<String, Object> mapBean = SpringUtil.getBean(new TypeReference<Map<String, Object>>() {});
|
||||
Assert.assertNotNull(mapBean);
|
||||
Assert.assertEquals("value1", mapBean.get("key1"));
|
||||
Assert.assertEquals("value2", mapBean.get("key2"));
|
||||
assertNotNull(mapBean);
|
||||
assertEquals("value1", mapBean.get("key1"));
|
||||
assertEquals("value2", mapBean.get("key2"));
|
||||
}
|
||||
|
||||
@Data
|
||||
|
@@ -3,9 +3,9 @@ package cn.hutool.extra.ssh;
|
||||
import cn.hutool.core.io.IoUtil;
|
||||
import cn.hutool.core.lang.Console;
|
||||
import com.jcraft.jsch.Session;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
@@ -18,7 +18,7 @@ import java.nio.charset.StandardCharsets;
|
||||
public class JschUtilTest {
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void bindPortTest() {
|
||||
//新建会话,此会话用于ssh连接到跳板机(堡垒机),此处为10.1.1.1:22
|
||||
Session session = JschUtil.getSession("looly.centos", 22, "test", "123456");
|
||||
@@ -28,13 +28,13 @@ public class JschUtilTest {
|
||||
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void bindRemotePort() throws InterruptedException {
|
||||
// 建立会话
|
||||
Session session = JschUtil.getSession("looly.centos", 22, "test", "123456");
|
||||
// 绑定ssh服务端8089端口到本机的8000端口上
|
||||
boolean b = JschUtil.bindRemotePort(session, 8089, "localhost", 8000);
|
||||
Assert.assertTrue(b);
|
||||
assertTrue(b);
|
||||
// 保证一直运行
|
||||
// while (true){
|
||||
// Thread.sleep(3000);
|
||||
@@ -42,7 +42,7 @@ public class JschUtilTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void sftpTest() {
|
||||
Session session = JschUtil.getSession("looly.centos", 22, "root", "123456");
|
||||
Sftp sftp = JschUtil.createSftp(session);
|
||||
@@ -51,7 +51,7 @@ public class JschUtilTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void reconnectIfTimeoutTest() throws InterruptedException {
|
||||
Session session = JschUtil.getSession("sunnyserver", 22,"mysftp","liuyang1234");
|
||||
Sftp sftp = JschUtil.createSftp(session);
|
||||
@@ -79,12 +79,12 @@ public class JschUtilTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void getSessionTest(){
|
||||
JschUtil.getSession("192.168.1.134", 22, "root", "aaa", null);
|
||||
}
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void sftpPrivateKeyTest(){
|
||||
Session session = JschUtil.getSession("192.168.1.109", 22, "root", ("-----BEGIN RSA PRIVATE KEY-----\n" +
|
||||
"MIIEpAIBAAKCAQEA5SJ1bjhSA0uQJjbbF/LCFiQvs+nMKgkSnSE+JEll7azv7jnh\n" +
|
||||
|
@@ -2,8 +2,8 @@ package cn.hutool.extra.ssh;
|
||||
|
||||
import cn.hutool.core.util.CharsetUtil;
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
@@ -19,13 +19,13 @@ public class SftpTest {
|
||||
private SshjSftp sshjSftp;
|
||||
|
||||
@Before
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void init() {
|
||||
sshjSftp = new SshjSftp("ip", 22, "test", "test", CharsetUtil.CHARSET_UTF_8);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void lsTest() {
|
||||
List<String> files = sshjSftp.ls("/");
|
||||
if (files != null && !files.isEmpty()) {
|
||||
@@ -34,33 +34,33 @@ public class SftpTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void downloadTest() {
|
||||
sshjSftp.recursiveDownloadFolder("/home/test/temp", new File("C:\\Users\\akwangl\\Downloads\\temp"));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void uploadTest() {
|
||||
sshjSftp.upload("/home/test/temp/", new File("C:\\Users\\akwangl\\Downloads\\temp\\辽宁_20190718_104324.CIME"));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void mkDirTest() {
|
||||
boolean flag = sshjSftp.mkdir("/home/test/temp");
|
||||
System.out.println("是否创建成功: " + flag);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void mkDirsTest() {
|
||||
// 在当前目录下批量创建目录
|
||||
sshjSftp.mkDirs("/home/test/temp");
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void delDirTest() {
|
||||
sshjSftp.delDir("/home/test/temp");
|
||||
}
|
||||
|
@@ -4,7 +4,7 @@ import cn.hutool.core.lang.Dict;
|
||||
import cn.hutool.core.util.CharsetUtil;
|
||||
import cn.hutool.extra.template.engine.freemarker.FreemarkerEngine;
|
||||
import lombok.Data;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class Issue3488Test {
|
||||
@Test
|
||||
@@ -23,7 +23,7 @@ public class Issue3488Test {
|
||||
|
||||
String result = template.render(Dict.create().set("paymentInfo", paymentInfo));
|
||||
//Console.log(result);
|
||||
//Assert.assertEquals("你好,hutool", result);
|
||||
//assertEquals("你好,hutool", result);
|
||||
}
|
||||
|
||||
@Data
|
||||
|
@@ -3,8 +3,8 @@ package cn.hutool.extra.template;
|
||||
import cn.hutool.core.lang.Dict;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.extra.template.engine.jetbrick.JetbrickEngine;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class JetbrickTest {
|
||||
|
||||
@@ -16,7 +16,7 @@ public class JetbrickTest {
|
||||
TemplateEngine engine = TemplateUtil.createEngine(config);
|
||||
Template template = engine.getTemplate("jetbrick_test.jetx");
|
||||
String result = template.render(Dict.create().set("name", "hutool"));
|
||||
Assert.assertEquals("你好,hutool", StrUtil.trim(result));
|
||||
assertEquals("你好,hutool", StrUtil.trim(result));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -27,6 +27,6 @@ public class JetbrickTest {
|
||||
TemplateEngine engine = TemplateUtil.createEngine(config);
|
||||
Template template = engine.getTemplate("hello,${name}");
|
||||
String result = template.render(Dict.create().set("name", "hutool"));
|
||||
Assert.assertEquals("hello,hutool", StrUtil.trim(result));
|
||||
assertEquals("hello,hutool", StrUtil.trim(result));
|
||||
}
|
||||
}
|
||||
|
@@ -10,9 +10,9 @@ import cn.hutool.extra.template.engine.rythm.RythmEngine;
|
||||
import cn.hutool.extra.template.engine.thymeleaf.ThymeleafEngine;
|
||||
import cn.hutool.extra.template.engine.velocity.VelocityEngine;
|
||||
import cn.hutool.extra.template.engine.wit.WitEngine;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.HashMap;
|
||||
@@ -32,13 +32,13 @@ public class TemplateUtilTest {
|
||||
TemplateEngine engine = TemplateUtil.createEngine(new TemplateConfig());
|
||||
Template template = engine.getTemplate("hello,${name}");
|
||||
String result = template.render(Dict.create().set("name", "hutool"));
|
||||
Assert.assertEquals("hello,hutool", result);
|
||||
assertEquals("hello,hutool", result);
|
||||
|
||||
// classpath中获取模板
|
||||
engine = TemplateUtil.createEngine(new TemplateConfig("templates", ResourceMode.CLASSPATH));
|
||||
Template template2 = engine.getTemplate("beetl_test.btl");
|
||||
String result2 = template2.render(Dict.create().set("name", "hutool"));
|
||||
Assert.assertEquals("hello,hutool", result2);
|
||||
assertEquals("hello,hutool", result2);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -47,13 +47,13 @@ public class TemplateUtilTest {
|
||||
TemplateEngine engine = new BeetlEngine(new TemplateConfig("templates"));
|
||||
Template template = engine.getTemplate("hello,${name}");
|
||||
String result = template.render(Dict.create().set("name", "hutool"));
|
||||
Assert.assertEquals("hello,hutool", result);
|
||||
assertEquals("hello,hutool", result);
|
||||
|
||||
// classpath中获取模板
|
||||
engine = new BeetlEngine(new TemplateConfig("templates", ResourceMode.CLASSPATH));
|
||||
Template template2 = engine.getTemplate("beetl_test.btl");
|
||||
String result2 = template2.render(Dict.create().set("name", "hutool"));
|
||||
Assert.assertEquals("hello,hutool", result2);
|
||||
assertEquals("hello,hutool", result2);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -63,12 +63,12 @@ public class TemplateUtilTest {
|
||||
new TemplateConfig("templates").setCustomEngine(RythmEngine.class));
|
||||
Template template = engine.getTemplate("hello,@name");
|
||||
String result = template.render(Dict.create().set("name", "hutool"));
|
||||
Assert.assertEquals("hello,hutool", result);
|
||||
assertEquals("hello,hutool", result);
|
||||
|
||||
// classpath中获取模板
|
||||
Template template2 = engine.getTemplate("rythm_test.tmpl");
|
||||
String result2 = template2.render(Dict.create().set("name", "hutool"));
|
||||
Assert.assertEquals("hello,hutool", result2);
|
||||
assertEquals("hello,hutool", result2);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -78,14 +78,14 @@ public class TemplateUtilTest {
|
||||
new TemplateConfig("templates", ResourceMode.STRING).setCustomEngine(FreemarkerEngine.class));
|
||||
Template template = engine.getTemplate("hello,${name}");
|
||||
String result = template.render(Dict.create().set("name", "hutool"));
|
||||
Assert.assertEquals("hello,hutool", result);
|
||||
assertEquals("hello,hutool", result);
|
||||
|
||||
//ClassPath模板
|
||||
engine = TemplateUtil.createEngine(
|
||||
new TemplateConfig("templates", ResourceMode.CLASSPATH).setCustomEngine(FreemarkerEngine.class));
|
||||
template = engine.getTemplate("freemarker_test.ftl");
|
||||
result = template.render(Dict.create().set("name", "hutool"));
|
||||
Assert.assertEquals("hello,hutool", result);
|
||||
assertEquals("hello,hutool", result);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -95,18 +95,18 @@ public class TemplateUtilTest {
|
||||
new TemplateConfig("templates", ResourceMode.STRING).setCustomEngine(VelocityEngine.class));
|
||||
Template template = engine.getTemplate("你好,$name");
|
||||
String result = template.render(Dict.create().set("name", "hutool"));
|
||||
Assert.assertEquals("你好,hutool", result);
|
||||
assertEquals("你好,hutool", result);
|
||||
|
||||
//ClassPath模板
|
||||
engine = TemplateUtil.createEngine(
|
||||
new TemplateConfig("templates", ResourceMode.CLASSPATH).setCustomEngine(VelocityEngine.class));
|
||||
template = engine.getTemplate("velocity_test.vtl");
|
||||
result = template.render(Dict.create().set("name", "hutool"));
|
||||
Assert.assertEquals("你好,hutool", result);
|
||||
assertEquals("你好,hutool", result);
|
||||
|
||||
template = engine.getTemplate("templates/velocity_test.vtl");
|
||||
result = template.render(Dict.create().set("name", "hutool"));
|
||||
Assert.assertEquals("你好,hutool", result);
|
||||
assertEquals("你好,hutool", result);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -116,14 +116,14 @@ public class TemplateUtilTest {
|
||||
new TemplateConfig("templates").setCustomEngine(EnjoyEngine.class));
|
||||
Template template = engine.getTemplate("#(x + 123)");
|
||||
String result = template.render(Dict.create().set("x", 1));
|
||||
Assert.assertEquals("124", result);
|
||||
assertEquals("124", result);
|
||||
|
||||
//ClassPath模板
|
||||
engine = new EnjoyEngine(
|
||||
new TemplateConfig("templates", ResourceMode.CLASSPATH).setCustomEngine(EnjoyEngine.class));
|
||||
template = engine.getTemplate("enjoy_test.etl");
|
||||
result = template.render(Dict.create().set("x", 1));
|
||||
Assert.assertEquals("124", result);
|
||||
assertEquals("124", result);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -133,18 +133,18 @@ public class TemplateUtilTest {
|
||||
new TemplateConfig("templates").setCustomEngine(ThymeleafEngine.class));
|
||||
Template template = engine.getTemplate("<h3 th:text=\"${message}\"></h3>");
|
||||
String result = template.render(Dict.create().set("message", "Hutool"));
|
||||
Assert.assertEquals("<h3>Hutool</h3>", result);
|
||||
assertEquals("<h3>Hutool</h3>", result);
|
||||
|
||||
//ClassPath模板
|
||||
engine = TemplateUtil.createEngine(
|
||||
new TemplateConfig("templates", ResourceMode.CLASSPATH).setCustomEngine(ThymeleafEngine.class));
|
||||
template = engine.getTemplate("thymeleaf_test.ttl");
|
||||
result = template.render(Dict.create().set("message", "Hutool"));
|
||||
Assert.assertEquals("<h3>Hutool</h3>", result);
|
||||
assertEquals("<h3>Hutool</h3>", result);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void renderToFileTest() {
|
||||
TemplateEngine engine = new BeetlEngine(new TemplateConfig("templates", ResourceMode.CLASSPATH));
|
||||
Template template = engine.getTemplate("freemarker_test.ftl");
|
||||
@@ -163,7 +163,7 @@ public class TemplateUtilTest {
|
||||
TemplateEngine engine = TemplateUtil.createEngine(config);
|
||||
Template template = engine.getTemplate("/wit_test.wit");
|
||||
String result = template.render(Dict.create().set("name", "hutool"));
|
||||
Assert.assertEquals("hello,hutool", StrUtil.trim(result));
|
||||
assertEquals("hello,hutool", StrUtil.trim(result));
|
||||
|
||||
// 字符串模板
|
||||
config = new TemplateConfig("templates", ResourceMode.STRING)
|
||||
@@ -171,6 +171,6 @@ public class TemplateUtilTest {
|
||||
engine = TemplateUtil.createEngine(config);
|
||||
template = engine.getTemplate("<%var name;%>hello,${name}");
|
||||
result = template.render(Dict.create().set("name", "hutool"));
|
||||
Assert.assertEquals("hello,hutool", StrUtil.trim(result));
|
||||
assertEquals("hello,hutool", StrUtil.trim(result));
|
||||
}
|
||||
}
|
||||
|
@@ -3,9 +3,9 @@ package cn.hutool.extra.template;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.lang.Dict;
|
||||
import cn.hutool.extra.template.engine.thymeleaf.ThymeleafEngine;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.thymeleaf.context.Context;
|
||||
import org.thymeleaf.standard.StandardDialect;
|
||||
import org.thymeleaf.templateresolver.StringTemplateResolver;
|
||||
@@ -31,7 +31,7 @@ public class ThymeleafTest {
|
||||
* 自定义操作原始引擎
|
||||
*/
|
||||
@Test
|
||||
@Ignore
|
||||
@Disabled
|
||||
public void addDialectTest(){
|
||||
final TemplateEngine engine = TemplateUtil.createEngine();
|
||||
if(engine instanceof ThymeleafEngine){
|
||||
@@ -61,7 +61,7 @@ public class ThymeleafTest {
|
||||
TemplateEngine engine = new ThymeleafEngine(new TemplateConfig());
|
||||
Template template = engine.getTemplate("<h3 th:each=\"item : ${list}\" th:text=\"${item.name}\"></h3>");
|
||||
String render = template.render(Dict.create().set("list", list));
|
||||
Assert.assertEquals("<h3>a</h3><h3>b</h3><h3>2019-01-01 00:00:00</h3>", render);
|
||||
assertEquals("<h3>a</h3><h3>b</h3><h3>2019-01-01 00:00:00</h3>", render);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -98,7 +98,7 @@ public class ThymeleafTest {
|
||||
Context context = new Context(Locale.getDefault(), map);
|
||||
templateEngine.process("<h3 th:each=\"item : ${list}\" th:text=\"${item.name}\"></h3>", context, writer);
|
||||
|
||||
Assert.assertEquals("<h3>a</h3><h3>b</h3><h3>2019-01-01 00:00:00</h3>", writer.toString());
|
||||
assertEquals("<h3>a</h3><h3>b</h3><h3>2019-01-01 00:00:00</h3>", writer.toString());
|
||||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
@@ -109,6 +109,6 @@ public class ThymeleafTest {
|
||||
Template template = engine.getTemplate("<h3 th:each=\"item : ${list}\" th:text=\"${item.name}\"></h3>");
|
||||
// "<h3 th:text=\"${nestMap.nestKey}\"></h3>"
|
||||
String render = template.render(map);
|
||||
Assert.assertEquals("<h3>a</h3><h3>b</h3><h3>2019-01-01 00:00:00</h3>", render);
|
||||
assertEquals("<h3>a</h3><h3>b</h3><h3>2019-01-01 00:00:00</h3>", render);
|
||||
}
|
||||
}
|
||||
|
@@ -3,8 +3,8 @@ package cn.hutool.extra.template;
|
||||
import cn.hutool.core.lang.Dict;
|
||||
import cn.hutool.core.util.CharsetUtil;
|
||||
import cn.hutool.extra.template.engine.velocity.VelocityEngine;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class VelocityTest {
|
||||
|
||||
@@ -16,6 +16,6 @@ public class VelocityTest {
|
||||
final TemplateEngine engine = TemplateUtil.createEngine(config);
|
||||
Template template = engine.getTemplate("velocity_test_gbk.vtl");
|
||||
String result = template.render(Dict.create().set("name", "hutool"));
|
||||
Assert.assertEquals("你好,hutool", result);
|
||||
assertEquals("你好,hutool", result);
|
||||
}
|
||||
}
|
||||
|
@@ -9,8 +9,8 @@ import cn.hutool.extra.tokenizer.engine.jieba.JiebaEngine;
|
||||
import cn.hutool.extra.tokenizer.engine.mmseg.MmsegEngine;
|
||||
import cn.hutool.extra.tokenizer.engine.mynlp.MynlpEngine;
|
||||
import cn.hutool.extra.tokenizer.engine.word.WordEngine;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
* 模板引擎单元测试
|
||||
@@ -35,7 +35,7 @@ public class TokenizerUtilTest {
|
||||
final TokenizerEngine engine = new HanLPEngine();
|
||||
final Result result = engine.parse(text);
|
||||
final String resultStr = IterUtil.join(result, " ");
|
||||
Assert.assertEquals("这 两 个 方法 的 区别 在于 返回 值", resultStr);
|
||||
assertEquals("这 两 个 方法 的 区别 在于 返回 值", resultStr);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -43,7 +43,7 @@ public class TokenizerUtilTest {
|
||||
final TokenizerEngine engine = new IKAnalyzerEngine();
|
||||
final Result result = engine.parse(text);
|
||||
final String resultStr = IterUtil.join(result, " ");
|
||||
Assert.assertEquals("这两个 方法 的 区别 在于 返回值", resultStr);
|
||||
assertEquals("这两个 方法 的 区别 在于 返回值", resultStr);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -58,7 +58,7 @@ public class TokenizerUtilTest {
|
||||
final TokenizerEngine engine = new JiebaEngine();
|
||||
final Result result = engine.parse(text);
|
||||
final String resultStr = IterUtil.join(result, " ");
|
||||
Assert.assertEquals("这 两个 方法 的 区别 在于 返回值", resultStr);
|
||||
assertEquals("这 两个 方法 的 区别 在于 返回值", resultStr);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -73,7 +73,7 @@ public class TokenizerUtilTest {
|
||||
final TokenizerEngine engine = new SmartcnEngine();
|
||||
final Result result = engine.parse(text);
|
||||
final String resultStr = IterUtil.join(result, " ");
|
||||
Assert.assertEquals("这 两 个 方法 的 区别 在于 返回 值", resultStr);
|
||||
assertEquals("这 两 个 方法 的 区别 在于 返回 值", resultStr);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -81,7 +81,7 @@ public class TokenizerUtilTest {
|
||||
final TokenizerEngine engine = new WordEngine();
|
||||
final Result result = engine.parse(text);
|
||||
final String resultStr = IterUtil.join(result, " ");
|
||||
Assert.assertEquals("这两个 方法 的 区别 在于 返回值", resultStr);
|
||||
assertEquals("这两个 方法 的 区别 在于 返回值", resultStr);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -89,11 +89,11 @@ public class TokenizerUtilTest {
|
||||
final TokenizerEngine engine = new MynlpEngine();
|
||||
final Result result = engine.parse(text);
|
||||
final String resultStr = IterUtil.join(result, " ");
|
||||
Assert.assertEquals("这 两个 方法 的 区别 在于 返回 值", resultStr);
|
||||
assertEquals("这 两个 方法 的 区别 在于 返回 值", resultStr);
|
||||
}
|
||||
|
||||
private void checkResult(final Result result) {
|
||||
final String resultStr = IterUtil.join(result, " ");
|
||||
Assert.assertEquals("这 两个 方法 的 区别 在于 返回 值", resultStr);
|
||||
assertEquals("这 两个 方法 的 区别 在于 返回 值", resultStr);
|
||||
}
|
||||
}
|
||||
|
@@ -1,7 +1,7 @@
|
||||
package cn.hutool.extra.validation;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
|
||||
@@ -40,14 +40,14 @@ public class BeanValidatorUtilTest {
|
||||
@Test
|
||||
public void beanValidatorTest() {
|
||||
BeanValidationResult result = ValidationUtil.warpValidate(new TestClass());
|
||||
Assert.assertFalse(result.isSuccess());
|
||||
Assert.assertEquals(2, result.getErrorMessages().size());
|
||||
assertFalse(result.isSuccess());
|
||||
assertEquals(2, result.getErrorMessages().size());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void propertyValidatorTest() {
|
||||
BeanValidationResult result = ValidationUtil.warpValidateProperty(new TestClass(), "name");
|
||||
Assert.assertFalse(result.isSuccess());
|
||||
Assert.assertEquals(1, result.getErrorMessages().size());
|
||||
assertFalse(result.isSuccess());
|
||||
assertEquals(1, result.getErrorMessages().size());
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user