mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-08-18 20:38:02 +08:00
24 lines
567 B
Java
24 lines
567 B
Java
package cn.hutool.extra.pinyin;
|
|
|
|
import cn.hutool.extra.pinyin.engine.jpinyin.JPinyinEngine;
|
|
import org.junit.jupiter.api.Assertions;
|
|
import org.junit.jupiter.api.Test;
|
|
|
|
public class JpinyinTest {
|
|
|
|
final JPinyinEngine engine = new JPinyinEngine();
|
|
|
|
@Test
|
|
public void getFirstLetterByPinyin4jTest(){
|
|
final String result = engine.getFirstLetter("林海", "");
|
|
Assertions.assertEquals("lh", result);
|
|
}
|
|
|
|
@Test
|
|
public void getPinyinByPinyin4jTest() {
|
|
final String pinyin = engine.getPinyin("你好h", " ");
|
|
Assertions.assertEquals("ni hao h", pinyin);
|
|
}
|
|
|
|
}
|