mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-04-19 03:01:48 +08:00
调整方法修饰符为public并添加junit测试例子
This commit is contained in:
parent
914463b4d8
commit
331fd1f2bc
@ -30,7 +30,7 @@ public class PunyCode {
|
||||
* @return
|
||||
* @throws UtilException
|
||||
*/
|
||||
private static String encodeDomain(String domain) throws UtilException{
|
||||
public static String encodeDomain(String domain) throws UtilException{
|
||||
Assert.notNull(domain, "domain must not be null!");
|
||||
String[] split = domain.split("\\.");
|
||||
StringBuilder outStringBuilder = new StringBuilder();
|
||||
@ -154,7 +154,7 @@ public class PunyCode {
|
||||
* @return
|
||||
* @throws UtilException
|
||||
*/
|
||||
private static String decodeDomain(String domain) throws UtilException{
|
||||
public static String decodeDomain(String domain) throws UtilException{
|
||||
Assert.notNull(domain, "domain must not be null!");
|
||||
String[] split = domain.split("\\.");
|
||||
StringBuilder outStringBuilder = new StringBuilder();
|
||||
|
@ -15,4 +15,12 @@ public class PunyCodeTest {
|
||||
decode = PunyCode.decode("xn--Hutool-ux9js33tgln");
|
||||
Assert.assertEquals(text, decode);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void encodeEncodeDomainTest(){
|
||||
String domain = "赵新虎.中国";
|
||||
String strPunyCode = PunyCode.encodeDomain(domain);
|
||||
String decode = PunyCode.decodeDomain(strPunyCode);
|
||||
Assert.assertEquals(decode, domain);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user