mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
fix code
This commit is contained in:
@@ -377,7 +377,7 @@ public class Convert {
|
||||
* @param defaultValue 转换错误时的默认值
|
||||
* @return 结果
|
||||
*/
|
||||
public static Boolean toBool(final Object value, final Boolean defaultValue) {
|
||||
public static Boolean toBoolean(final Object value, final Boolean defaultValue) {
|
||||
return convertQuietly(Boolean.class, value, defaultValue);
|
||||
}
|
||||
|
||||
@@ -389,8 +389,8 @@ public class Convert {
|
||||
* @param value 被转换的值
|
||||
* @return 结果
|
||||
*/
|
||||
public static Boolean toBool(final Object value) {
|
||||
return toBool(value, null);
|
||||
public static Boolean toBoolean(final Object value) {
|
||||
return toBoolean(value, null);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -8,17 +8,17 @@ public class ConvertToBooleanTest {
|
||||
@Test
|
||||
public void intToBooleanTest() {
|
||||
final int a = 100;
|
||||
final Boolean aBoolean = Convert.toBool(a);
|
||||
final Boolean aBoolean = Convert.toBoolean(a);
|
||||
Assert.assertTrue(aBoolean);
|
||||
|
||||
final int b = 0;
|
||||
final Boolean bBoolean = Convert.toBool(b);
|
||||
final Boolean bBoolean = Convert.toBoolean(b);
|
||||
Assert.assertFalse(bBoolean);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void issueI65P8ATest() {
|
||||
final Boolean bool = Convert.toBool("", Boolean.TRUE);
|
||||
final Boolean bool = Convert.toBoolean("", Boolean.TRUE);
|
||||
Assert.assertFalse(bool);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user