From 6f6679fd4c1b338b935f111ee1957e7d0cfe14ad Mon Sep 17 00:00:00 2001 From: fdai6040 Date: Tue, 7 Feb 2023 19:41:04 +0100 Subject: [PATCH] Test "Text reverse" added --- src/main/java/src/TasksFrame.java | 2 +- src/test/java/src/TasksFrameTest.java | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/main/java/src/TasksFrame.java b/src/main/java/src/TasksFrame.java index 87cdf99..289750b 100644 --- a/src/main/java/src/TasksFrame.java +++ b/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)); diff --git a/src/test/java/src/TasksFrameTest.java b/src/test/java/src/TasksFrameTest.java index 70e10c3..dee0bbb 100644 --- a/src/test/java/src/TasksFrameTest.java +++ b/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); + } }