BAEL-5354 Add improvement to cover JDK11 solution to the repeated string problem (#11756)
This commit is contained in:
@@ -49,8 +49,9 @@
|
||||
</build>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>11</maven.compiler.source>
|
||||
<maven.compiler.target>11</maven.compiler.target>
|
||||
<validator.version>1.7</validator.version>
|
||||
<apache-commons-lang3.version>3.12.0</apache-commons-lang3.version>
|
||||
</properties>
|
||||
|
||||
</project>
|
||||
@@ -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