Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
josdem committed May 7, 2024
2 parents c98a7d4 + e0e703a commit f103443
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@

public class PhoneNumberGenerator {
public String format(List<Integer> numbers) {
final StringBuilder sb = new StringBuilder();
String arrayAsString =
numbers.stream().map(String::valueOf).reduce("", String::concat);
sb.append(arrayAsString).insert(0, '(').insert(4, ')').insert(5, ' ').insert(9, '-');
return sb.toString();
return numbers.toString();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ class PhoneNumberGeneratorTest {
@DisplayName("Format a phone number")
void shouldFormatPhoneNumber() {
assertEquals(
"(123) 456-7890", phoneNumberGenerator.format(Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9, 0));
"(123) 456-7890", phoneNumberGenerator.format(Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9, 0)));
}
}

0 comments on commit f103443

Please sign in to comment.