Bael 3207 convert char array to string (#7720)
* BAEL-320 Convert Char Array to String * BAEL-3207 re-formatting * BAEL-3207 some changes
This commit is contained in:
parent
7472127909
commit
c4a1b44b39
|
@ -41,11 +41,11 @@ public class CharArrayToStringConversionUnitTest {
|
|||
|
||||
@Test
|
||||
public void whenStringBuilder_thenOK() {
|
||||
final char[] charArray = { 'b', 'a', 'e', 'l', 'd', 'u', 'n', 'g' };
|
||||
final char[][] arrayOfCharArray = { { 'b', 'a' }, { 'e', 'l', 'd', 'u' }, { 'n', 'g' } };
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (char value : charArray) {
|
||||
sb.append(value);
|
||||
for (char[] subArray : arrayOfCharArray) {
|
||||
sb.append(subArray);
|
||||
}
|
||||
|
||||
assertThat(sb.toString(), is("baeldung"));
|
||||
|
@ -65,9 +65,8 @@ public class CharArrayToStringConversionUnitTest {
|
|||
public void whenGoogleCommonBaseJoiners_thenOK() {
|
||||
final Character[] charArray = { 'b', 'a', 'e', 'l', 'd', 'u', 'n', 'g' };
|
||||
|
||||
String string = Joiner.on("").join(charArray);
|
||||
String string = Joiner.on("|").join(charArray);
|
||||
|
||||
assertThat(string, is("baeldung"));
|
||||
assertThat(string, is("b|a|e|l|d|u|n|g"));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue