From 1c291b3142fbf124b579a7c5bcadf7303b1cd8a2 Mon Sep 17 00:00:00 2001 From: MAMBILA TETE jean philipp <@mambilat> Date: Mon, 18 Mar 2024 16:41:29 +0100 Subject: [PATCH] Tests for classes ScheduleFormat and NetworkFormat complete. --- .../gla/project/io/ScheduleFormatTest.java | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 src/test/java/fr/u_paris/gla/project/io/ScheduleFormatTest.java diff --git a/src/test/java/fr/u_paris/gla/project/io/ScheduleFormatTest.java b/src/test/java/fr/u_paris/gla/project/io/ScheduleFormatTest.java new file mode 100644 index 0000000..4b0f749 --- /dev/null +++ b/src/test/java/fr/u_paris/gla/project/io/ScheduleFormatTest.java @@ -0,0 +1,33 @@ +package fr.u_paris.gla.project.io; + +import org.junit.jupiter.api.Test; + +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import java.util.Arrays; +import java.util.List; + +import static org.junit.jupiter.api.Assertions.*; + +class ScheduleFormatTest { + + @Test + void getTripSequence() { + String rpz = "4, 5, 19, 21"; + List test = Arrays.asList(4, 5, 19, 21); + + assertEquals(test, ScheduleFormat.getTripSequence(rpz)); + } + + @Test + void getTimeFormatter() { + DateTimeFormatter formatter = ScheduleFormat.getTimeFormatter(); + LocalDateTime date = LocalDateTime.now(); + String test = date.format(formatter); + //format date: YYYY-MM-DDTHH:MM:SS.DECIMAL + assertEquals(date.toString().substring(11, 16), test); + + + } +} \ No newline at end of file