Browse Source

Test "Text reverse" added

remotes/origin/develop
fdai6040 2 years ago
parent
commit
6f6679fd4c
  1. 2
      src/main/java/src/TasksFrame.java
  2. 11
      src/test/java/src/TasksFrameTest.java

2
src/main/java/src/TasksFrame.java

@ -138,7 +138,7 @@ public class TasksFrame extends JFrame {
});
}
private String reverse(String text) {
public String reverse(String text) {
StringBuilder reversed = new StringBuilder();
for (int i = text.length() - 1; i >= 0; i--) {
reversed.append(text.charAt(i));

11
src/test/java/src/TasksFrameTest.java

@ -249,6 +249,17 @@ class TasksFrameTest {
double c = tasksFrame.kreisUmfang(0);
assertEquals(0, c);
}
@Test
void test_reverse(){
TasksFrame tasksFrame = new TasksFrame();
String text1 = tasksFrame.reverse("dania");
assertEquals("ainad", text1);
String text2 = tasksFrame.reverse("commit");
assertEquals("timmoc", text2);
String text3 = tasksFrame.reverse("morgen");
assertEquals("negrom", text3);
}
}

Loading…
Cancel
Save