Skip to content

Commit 7117acf

Browse files
committed
fix: Replace String.repeat() with Java 8 compatible implementation
- String.repeat() was introduced in Java 11 - GitHub Actions uses Java 8 (Temurin) - Added repeatString() helper method for Java 8 compatibility - All tests remain functional
1 parent e6705e7 commit 7117acf

File tree

1 file changed

+17
-6
lines changed

1 file changed

+17
-6
lines changed

src/test/java/com/contentstack/sdk/BaseIntegrationTest.java

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@ public static void setUpBase() {
4747
*/
4848
@BeforeAll
4949
public void logTestSuiteStart() {
50-
logger.info("=" .repeat(60));
50+
logger.info(repeatString("=", 60));
5151
logger.info("Starting Test Suite: " + this.getClass().getSimpleName());
52-
logger.info("=" .repeat(60));
52+
logger.info(repeatString("=", 60));
5353

5454
// Log available test data
5555
if (TestHelpers.isComplexTestDataAvailable()) {
@@ -68,17 +68,17 @@ public void logTestSuiteStart() {
6868
*/
6969
@AfterAll
7070
public void logTestSuiteEnd(TestInfo testInfo) {
71-
logger.info("=" .repeat(60));
71+
logger.info(repeatString("=", 60));
7272
logger.info("Completed Test Suite: " + this.getClass().getSimpleName());
73-
logger.info("=" .repeat(60));
73+
logger.info(repeatString("=", 60));
7474
}
7575

7676
/**
7777
* Log individual test start
7878
*/
7979
@BeforeEach
8080
public void logTestStart(TestInfo testInfo) {
81-
logger.info("-".repeat(60));
81+
logger.info(repeatString("-", 60));
8282
logger.info("Starting Test: " + testInfo.getDisplayName());
8383
}
8484

@@ -88,7 +88,18 @@ public void logTestStart(TestInfo testInfo) {
8888
@AfterEach
8989
public void logTestEnd(TestInfo testInfo) {
9090
logger.info("Completed Test: " + testInfo.getDisplayName());
91-
logger.info("-".repeat(60));
91+
logger.info(repeatString("-", 60));
92+
}
93+
94+
/**
95+
* Repeat a string n times (Java 8 compatible)
96+
*/
97+
private String repeatString(String str, int count) {
98+
StringBuilder sb = new StringBuilder();
99+
for (int i = 0; i < count; i++) {
100+
sb.append(str);
101+
}
102+
return sb.toString();
92103
}
93104

94105
/**

0 commit comments

Comments
 (0)