BAEL-5354 Add improvement to cover JDK11 solution to the repeated string problem (#11756)

This commit is contained in:
ashleyfrieze
2022-01-31 03:49:04 +00:00
committed by GitHub
parent 831a0a1cf5
commit 73addd6246
4 changed files with 15 additions and 2 deletions

View File

@@ -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>

View File

@@ -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);