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 6f6b8e23e0
commit 69e04d5ac0
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);

View File

@ -107,7 +107,6 @@
<module>core-java-streams-4</module>
<module>core-java-string-algorithms</module>
<module>core-java-string-algorithms-2</module>
<module>core-java-string-algorithms-3</module>
<module>core-java-string-apis</module>
<module>core-java-string-conversions</module>
<module>core-java-string-conversions-2</module>

View File

@ -1333,6 +1333,7 @@
<module>core-java-modules/core-java-io-conversions-2</module>
<module>core-java-modules/core-java-jpms</module>
<module>core-java-modules/core-java-os</module>
<module>core-java-modules/core-java-string-algorithms-3</module>
<module>core-java-modules/core-java-string-operations-3</module>
<module>core-java-modules/core-java-string-operations-4</module>
<module>core-java-modules/core-java-time-measurements</module>