mirror of
https://github.com/TheAlgorithms/Java.git
synced 2025-07-29 07:26:01 +08:00
32 lines
808 B
Java
32 lines
808 B
Java
package com.thealgorithms.strings;
|
|
|
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
|
|
|
import org.junit.jupiter.api.Test;
|
|
|
|
public class ReverseStringRecursiveTest {
|
|
@Test
|
|
void shouldAcceptWhenEmptyStringIsPassed() {
|
|
String expected = "";
|
|
String reversed = ReverseStringRecursive.reverse("");
|
|
|
|
assertEquals(expected, reversed);
|
|
}
|
|
|
|
@Test
|
|
void shouldAcceptNotWhenWhenSingleCharacterIsPassed() {
|
|
String expected = "a";
|
|
String reversed = ReverseStringRecursive.reverse("a");
|
|
|
|
assertEquals(expected, reversed);
|
|
}
|
|
|
|
@Test
|
|
void shouldAcceptWhenStringIsPassed() {
|
|
String expected = "dlroWolleH";
|
|
String reversed = ReverseStringRecursive.reverse("HelloWorld");
|
|
|
|
assertEquals(expected, reversed);
|
|
}
|
|
}
|