mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
fix convert to int bug
This commit is contained in:
@@ -217,4 +217,11 @@ public class MapUtilTest {
|
||||
Assert.assertEquals(Integer.valueOf(1), map.get("a"));
|
||||
Assert.assertEquals(Integer.valueOf(2), map.get("b"));
|
||||
}
|
||||
|
||||
@Test(expected = NumberFormatException.class)
|
||||
public void getIntTest(){
|
||||
final HashMap<String, String> map = MapUtil.of("age", "d");
|
||||
final Integer age = MapUtil.getInt(map, "age");
|
||||
Assert.assertNotNull(age);
|
||||
}
|
||||
}
|
||||
|
@@ -287,6 +287,12 @@ public class NumberUtilTest {
|
||||
Assert.assertEquals(1482, v1);
|
||||
}
|
||||
|
||||
@Test(expected = NumberFormatException.class)
|
||||
public void parseIntTest3() {
|
||||
int v1 = NumberUtil.parseInt("d");
|
||||
Assert.assertEquals(0, v1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void parseNumberTest() {
|
||||
// from 5.4.8 issue#I23ORQ@Gitee
|
||||
|
Reference in New Issue
Block a user