mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-08-18 20:38:02 +08:00
fix convert
This commit is contained in:
@@ -4,6 +4,7 @@ import cn.hutool.core.annotation.Alias;
|
||||
import cn.hutool.core.bean.copier.CopyOptions;
|
||||
import cn.hutool.core.bean.copier.ValueProvider;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.lang.Console;
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import lombok.Data;
|
||||
import lombok.Getter;
|
||||
|
@@ -2,6 +2,7 @@ package cn.hutool.core.convert;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.Getter;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
@@ -253,4 +254,28 @@ public class ConvertTest {
|
||||
private String cName;
|
||||
private String version;
|
||||
}
|
||||
|
||||
@Test
|
||||
public void enumToIntTest(){
|
||||
final Integer integer = Convert.toInt(BuildingType.CUO);
|
||||
Assert.assertEquals(1, integer.intValue());
|
||||
}
|
||||
|
||||
@Getter
|
||||
public enum BuildingType {
|
||||
PING(1, "平层"),
|
||||
CUO(2, "错层"),
|
||||
YUE(3, "跃层"),
|
||||
FUSHI(4, "复式"),
|
||||
KAIJIAN(5, "开间"),
|
||||
OTHER(6, "其他");
|
||||
|
||||
private final int id;
|
||||
private final String name;
|
||||
|
||||
BuildingType(int id, String name){
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -164,6 +164,7 @@ public class StrUtilTest {
|
||||
Assert.assertEquals(-1, StrUtil.lastIndexOfIgnoreCase("aabaabaa", "B", -1));
|
||||
Assert.assertEquals(2, StrUtil.lastIndexOfIgnoreCase("aabaabaa", "", 2));
|
||||
Assert.assertEquals(3, StrUtil.lastIndexOfIgnoreCase("abc", "", 9));
|
||||
Assert.assertEquals(0, StrUtil.lastIndexOfIgnoreCase("AAAcsd", "aaa"));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
Reference in New Issue
Block a user