BAEL-5354 Add improvement to cover JDK11 solution to the repeated string problem (#11756)
This commit is contained in:
@@ -19,6 +19,18 @@ class RepeatedCharacterStringUnitTest {
|
||||
private static final String EXPECTED_STRING = "aaaaaaa";
|
||||
private static final int N = 7;
|
||||
|
||||
@Test
|
||||
void givenSingleCharacterString_whenRepeat_thenStringCreated() {
|
||||
String newString = "a".repeat(N);
|
||||
assertEquals(EXPECTED_STRING, newString);
|
||||
}
|
||||
|
||||
@Test
|
||||
void givenMultiCharacterString_whenRepeat_thenStringCreated() {
|
||||
String newString = "-->".repeat(5);
|
||||
assertEquals("-->-->-->-->-->", newString);
|
||||
}
|
||||
|
||||
@Test
|
||||
void givenString_whenStringBuilderUsed_thenStringCreated() {
|
||||
StringBuilder builder = new StringBuilder(N);
|
||||
|
||||
Reference in New Issue
Block a user