Skip to content

Commit ceb6b93

Browse files
committed
Refactored ReverseStringUsingStack
1 parent b7fbbcd commit ceb6b93

File tree

4 files changed

+5
-83
lines changed

4 files changed

+5
-83
lines changed

src/main/java/com/thealgorithms/stacks/ReverseStringUsingStack.java

Lines changed: 0 additions & 34 deletions
This file was deleted.

src/main/java/com/thealgorithms/strings/ReverseString.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public static String reverse3(String string) {
6565
* * @param str The input string to be reversed.
6666
* @return The reversed string.
6767
*/
68-
public static String reverse4(String str) {
68+
public static String reverseStringUsingStack(String str) {
6969
// Check if the input string is null
7070
if (str == null) {
7171
throw new IllegalArgumentException("Input string cannot be null");

src/test/java/com/thealgorithms/stacks/ReverseStringUsingStackTest.java

Lines changed: 0 additions & 44 deletions
This file was deleted.

src/test/java/com/thealgorithms/strings/ReverseStringTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,12 @@ public void testReverseString3(String input, String expectedOutput) {
3636

3737
@ParameterizedTest
3838
@MethodSource("testCases")
39-
public void testReverseString4(String input, String expectedOutput) {
40-
assertEquals(expectedOutput, ReverseString.reverse4(input));
39+
public void testReverseStringUsingStack(String input, String expectedOutput) {
40+
assertEquals(expectedOutput, ReverseString.reverseStringUsingStack(input));
4141
}
4242

4343
@Test
44-
public void testReverseString4WithNullInput() {
45-
assertThrows(IllegalArgumentException.class, () -> ReverseString.reverse4(null));
44+
public void testReverseStringUsingStackWithNullInput() {
45+
assertThrows(IllegalArgumentException.class, () -> ReverseString.reverseStringUsingStack(null));
4646
}
4747
}

0 commit comments

Comments
 (0)