mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-05-09 23:51:34 +08:00
add test
This commit is contained in:
parent
dc601b880b
commit
15c1237ecc
@ -219,7 +219,7 @@ public class DateUtil {
|
|||||||
return formatDate(new DateTime());
|
return formatDate(new DateTime());
|
||||||
}
|
}
|
||||||
|
|
||||||
// -------------------------------------------------------------- Part of Date start
|
// region ----- Part of Date start
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获得年的部分
|
* 获得年的部分
|
||||||
@ -497,7 +497,7 @@ public class DateUtil {
|
|||||||
public static int thisMillisecond() {
|
public static int thisMillisecond() {
|
||||||
return millisecond(now());
|
return millisecond(now());
|
||||||
}
|
}
|
||||||
// -------------------------------------------------------------- Part of Date end
|
// endregion
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获得指定日期年份和季节<br>
|
* 获得指定日期年份和季节<br>
|
||||||
|
@ -209,4 +209,17 @@ public class UserAgent implements Serializable {
|
|||||||
this.engineVersion = engineVersion;
|
this.engineVersion = engineVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "UserAgent{" +
|
||||||
|
"mobile=" + mobile +
|
||||||
|
", browser=" + browser +
|
||||||
|
", version='" + version + '\'' +
|
||||||
|
", platform=" + platform +
|
||||||
|
", os=" + os +
|
||||||
|
", osVersion='" + osVersion + '\'' +
|
||||||
|
", engine=" + engine +
|
||||||
|
", engineVersion='" + engineVersion + '\'' +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,16 @@
|
|||||||
|
package org.dromara.hutool.http.useragent;
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Assertions;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* https://android-developers.googleblog.com/2024/12/user-agent-reduction-on-android-webview.html
|
||||||
|
*/
|
||||||
|
public class Issue3813Test {
|
||||||
|
@Test
|
||||||
|
void parseTest() {
|
||||||
|
final String ua = "Mozilla/5.0 (Linux; Android 10; K; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/125.000 Mobile Safari/537.36";
|
||||||
|
final UserAgent parse = UserAgentUtil.parse(ua);
|
||||||
|
Assertions.assertEquals("UserAgent{mobile=true, browser=Chrome, version='125.000', platform=Android, os=Android, osVersion='10', engine=Webkit, engineVersion='537.36'}", parse.toString());
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user