mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-04-19 03:01:48 +08:00
add test
This commit is contained in:
parent
a8a4f16bec
commit
2200701d7e
@ -7,10 +7,11 @@ import cn.hutool.core.collection.SetUtil;
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.exceptions.CloneRuntimeException;
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.lang.func.SerSupplier;
|
||||
import cn.hutool.core.lang.func.LambdaUtil;
|
||||
import cn.hutool.core.lang.func.SerSupplier;
|
||||
import cn.hutool.core.lang.getter.BasicTypeGetter;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigInteger;
|
||||
import java.sql.Time;
|
||||
@ -564,7 +565,7 @@ public class Dict extends CustomKeyMap<String, Object> implements BasicTypeGette
|
||||
* @see BeanPath#get(Object)
|
||||
* @since 5.7.14
|
||||
*/
|
||||
public <T> T getByPath(final String expression, final Class<T> resultType) {
|
||||
public <T> T getByPath(final String expression, final Type resultType) {
|
||||
return Convert.convert(resultType, getByPath(expression));
|
||||
}
|
||||
// -------------------------------------------------------------------- Get end
|
||||
@ -573,7 +574,7 @@ public class Dict extends CustomKeyMap<String, Object> implements BasicTypeGette
|
||||
public Dict clone() {
|
||||
try {
|
||||
return (Dict) super.clone();
|
||||
} catch (CloneNotSupportedException e) {
|
||||
} catch (final CloneNotSupportedException e) {
|
||||
throw new CloneRuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
25
hutool-core/src/test/java/cn/hutool/core/text/dfa/issueI5Q4HDTest.java
Executable file
25
hutool-core/src/test/java/cn/hutool/core/text/dfa/issueI5Q4HDTest.java
Executable file
@ -0,0 +1,25 @@
|
||||
package cn.hutool.core.text.dfa;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public class issueI5Q4HDTest {
|
||||
|
||||
@Test
|
||||
public void matchAllTest(){
|
||||
final String content="站房建设面积较小,不符合规范要求。辅助设施_站房_面积";
|
||||
final String keywordStr="不符合规范要求,现场手工比对孔不规范,采样口,现场,辅助设施,比对孔未处于监测断面下游,站房,未设置,标识,给排水,面积较小,监控设备,灭火装置,排污口,设备操作维护不方便,不规范,采样平台,参比方法,直爬梯,单独,站房建设,不健全,没有配置";
|
||||
final List<String> keyWords = Arrays.asList(keywordStr.split(","));
|
||||
final Set<String> keyWordSet=new HashSet<>(keyWords);
|
||||
final WordTree wordTree=new WordTree();
|
||||
wordTree.addWords(keyWordSet);
|
||||
//DateUtil.beginOfHour()
|
||||
final List<String> strings = wordTree.matchAll(content, -1, true, true);
|
||||
Assert.assertEquals("[站房, 站房建设, 面积较小, 不符合规范要求, 辅助设施, 站房]", strings.toString());
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user