fix: placement and tests

This commit is contained in:
2026-04-17 01:09:22 +03:30
parent 636de18d6c
commit 87affb5e56
8 changed files with 20 additions and 36 deletions
+47
View File
@@ -0,0 +1,47 @@
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNull;
public class BonusTestDates {
static BonusExercises ex;
@BeforeAll
static void setUp() {
ex = new BonusExercises();
}
@Test
void testDates0() {
String input = "Today is 12/09/2023.";
String expected = "12/09/2023";
assertEquals(expected, ex.findDate(input));
}
@Test
void testDates1() {
String input = "Meeting: 2024-07-15 at noon.";
String expected = "2024-07-15";
assertEquals(expected, ex.findDate(input));
}
@Test
void testDates2() {
String input = "No date here.";
assertNull(ex.findDate(input));
}
@Test
void testDates3() {
String input = "Release date will be 2025/01/01 (hopefully) at midnight";
String expected = "2025/01/01";
assertEquals(expected, ex.findDate(input));
}
@Test
void testDates4() {
String input = "Meet me at 45/12/2023.";
assertNull(ex.findDate(input));
}
}