Add tests for merge sort (#3715)

This commit is contained in:
shlokam
2022-11-01 00:56:49 +05:30
committed by GitHub
parent 3542f1c4c1
commit 9e7456a2a8
3 changed files with 136 additions and 0 deletions

View File

@ -0,0 +1,33 @@
package com.thealgorithms.strings;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
public class ReverseStringRecursiveTest {
ReverseStringRecursive stringRecursive = new ReverseStringRecursive();
@Test
void shouldAcceptWhenEmptyStringIsPassed() {
String expected = "";
String reversed = stringRecursive.reverse("");
assertEquals(expected,reversed);
}
@Test
void shouldAcceptNotWhenWhenSingleCharacterIsPassed() {
String expected = "a";
String reversed = stringRecursive.reverse("a");
assertEquals(expected,reversed);
}
@Test
void shouldAcceptWhenStringIsPassed() {
String expected = "dlroWolleH";
String reversed = stringRecursive.reverse("HelloWorld");
assertEquals(expected,reversed);
}
}