|
12 | 12 | import org.junit.Test; |
13 | 13 |
|
14 | 14 | import java.util.Arrays; |
15 | | -import java.util.Collections; |
16 | 15 | import java.util.HashSet; |
17 | 16 | import java.util.List; |
18 | | -import java.util.Set; |
19 | 17 | import java.util.stream.Collectors; |
20 | 18 | import java.util.stream.IntStream; |
21 | 19 |
|
@@ -87,18 +85,17 @@ public void toCodePointList_isCorrect() |
87 | 85 | } |
88 | 86 |
|
89 | 87 | @Test |
90 | | - public void addCodePointsToSet_isCorrect() |
| 88 | + public void toCodePointSet_isCorrect() |
91 | 89 | { |
92 | | - final int SOME_CODE_POINT = 0x1234; |
93 | | - final Set<Integer> commonsCodePointSet = new HashSet<>(Collections.singletonList(SOME_CODE_POINT)); |
94 | | - Stringy.addCodePointsToSet("天下為公", commonsCodePointSet); |
95 | | - assertEquals(commonsCodePointSet, new HashSet<>(Arrays.asList(SOME_CODE_POINT, 0x5929, 0x4E0B, 0x70BA, 0x516C))); |
96 | | - |
97 | | - final Set<Integer> asciiFullCodePointSet = new HashSet<>(); |
98 | | - Stringy.addCodePointsToSet(ASCII_FULL_STRING, asciiFullCodePointSet); |
99 | | - assertEquals(asciiFullCodePointSet, new HashSet<>(ASCII_CODE_POINT_RANGE)); |
| 90 | + assertEquals(Stringy.toCodePointSet(ASCII_FULL_STRING), new HashSet<>(ASCII_CODE_POINT_RANGE)); |
| 91 | + assertEquals(Stringy.toCodePointSet("天下為公"), new HashSet<>(Arrays.asList(0x5929, 0x4E0B, 0x70BA, 0x516C))); |
| 92 | + |
| 93 | + assertEquals( |
| 94 | + Stringy.toCodePointSet(Arrays.asList("ABC", "天地玄黃", "BCD")), |
| 95 | + new HashSet<>(Arrays.asList(0x41, 0x42, 0x43, 0x5929, 0x5730, 0x7384, 0x9EC3, 0x44)) |
| 96 | + ); |
100 | 97 | } |
101 | | - |
| 98 | + |
102 | 99 | @Test |
103 | 100 | public void toString_isCorrect() |
104 | 101 | { |
|
0 commit comments