Skip to content

Commit 768b290

Browse files
author
Gonzalo Diaz
committed
[REFACTOR] String formatting.
1 parent abe28ad commit 768b290

File tree

5 files changed

+17
-15
lines changed

5 files changed

+17
-15
lines changed

algorithm-exercises-java/src/test/java/ae/hackerrank/interview_preparation_kit/arrays/ArraysLeftRotationTest.java

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,11 @@ public void setup() throws IOException {
3838
List<Integer> solutionFound = ArraysLeftRotation.rotLeftOne(test.input);
3939

4040
assertEquals(test.expected, solutionFound,
41-
String.format("%s(%s) answer must be: %s",
42-
"CompareTriplets.compareTriplets",
41+
"%s(%s) answer must be: %s".formatted(
42+
"ArraysLeftRotation.rotLeftOne",
4343
test.input,
44-
test.expected)
44+
test.expected
45+
)
4546
);
4647
}
4748
}
@@ -54,11 +55,12 @@ public void setup() throws IOException {
5455
List<Integer> solutionFound = ArraysLeftRotation.rotLeft(input, d);
5556

5657
assertEquals(expected, solutionFound,
57-
String.format("%s(%s, %d) answer must be: %s",
58-
"CompareTriplets.compareTriplets",
59-
input.toString(),
60-
d,
61-
expected.toString())
58+
"%s(%s, %d) answer must be: %s".formatted(
59+
"ArraysLeftRotation.rotLeftOne",
60+
input,
61+
d,
62+
expected
63+
)
6264
);
6365
}
6466
}

algorithm-exercises-java/src/test/java/ae/hackerrank/interview_preparation_kit/arrays/CrushBruteForceTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public void setup() throws IOException {
3838
.arrayManipulation(testCase.n, testCase.queries);
3939

4040
assertEquals(testCase.expected, solutionFound,
41-
String.format("%s(%d, %s) answer must be: %s",
41+
"%s(%d, %s) answer must be: %s".formatted(
4242
"CrushBruteForce.arrayManipulation",
4343
testCase.n,
4444
testCase.queries.toString(),

algorithm-exercises-java/src/test/java/ae/hackerrank/interview_preparation_kit/arrays/CrushTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,12 @@ public void setup() throws IOException {
3939
.arrayManipulation(testCase.n, testCase.queries);
4040

4141
assertEquals(testCase.expected, solutionFound,
42-
String.format("%s(%d, %s) answer must be: %s",
42+
"%s(%d, %s) answer must be: %s".formatted(
4343
"CrushOptimized.arrayManipulation",
4444
testCase.n,
4545
testCase.queries.toString(),
4646
testCase.expected
47-
)
47+
)
4848
);
4949
}
5050
}

algorithm-exercises-java/src/test/java/ae/hackerrank/interview_preparation_kit/dictionaries_and_hashmaps/RansomNoteTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ public void setup() throws IOException {
3737
String solutionFound = RansomNote.checkMagazine(test.magazine, test.note);
3838

3939
assertEquals(test.expected, solutionFound,
40-
String.format("%s(%s, %s) answer must be: %s",
41-
"CrushOptimized.arrayManipulation",
40+
"%s(%s, %s) answer must be: %s".formatted(
41+
"RansomNote.checkMagazine",
4242
test.magazine,
4343
test.note,
4444
test.expected

algorithm-exercises-java/src/test/java/ae/hackerrank/interview_preparation_kit/dictionaries_and_hashmaps/TwoStringsTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ public void setup() throws IOException {
4040
String solutionFound = TwoStrings.twoStrings(test.s1, test.s2);
4141

4242
assertEquals(test.expected, solutionFound,
43-
String.format("%s(%s, %s) answer must be: %s",
44-
"CrushOptimized.arrayManipulation",
43+
"%s(%s, %s) answer must be: %s".formatted(
44+
"TwoStrings.twoStrings",
4545
test.s1,
4646
test.s2,
4747
test.expected

0 commit comments

Comments
 (0)