diff --git a/pom.xml b/pom.xml
index 61d26c4..5c9b0da 100644
--- a/pom.xml
+++ b/pom.xml
@@ -31,7 +31,7 @@
org.json
json
- 20230618
+ 20231013
@@ -67,6 +67,18 @@
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+ 3.2.5
+
+
+ **/*Test.java
+
+ true
+
+
diff --git a/src/test/java/fr/u_paris/gla/project/AppTest.java b/src/test/java/fr/u_paris/gla/project/AppTest.java
index 2351945..cdb42b4 100644
--- a/src/test/java/fr/u_paris/gla/project/AppTest.java
+++ b/src/test/java/fr/u_paris/gla/project/AppTest.java
@@ -8,7 +8,7 @@ import org.junit.jupiter.api.Test;
class AppTest {
/** Rigorous Test :-) */
@Test
- void testPlaceholder() {
+ public void testPlaceholder() {
assertTrue(true, "It should be true that true is true...");
}
}
diff --git a/src/test/java/fr/u_paris/gla/project/idfm/StopTest.java b/src/test/java/fr/u_paris/gla/project/idfm/StopTest.java
new file mode 100644
index 0000000..6139466
--- /dev/null
+++ b/src/test/java/fr/u_paris/gla/project/idfm/StopTest.java
@@ -0,0 +1,68 @@
+package fr.u_paris.gla.project.idfm;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.*;
+
+public class StopTest {
+
+
+ @Test
+ public void testIsStopConnected() {
+
+ Stop stop = new Stop("Stop1");
+ BifStop bifStop1 = new BifStop(1, new Stop("Stop2"));
+ // Initially, no stops are connected
+ assertFalse(stop.isStopConnected("Stop2"));
+
+ // Add a connected stop
+ stop.addConnectedStop(bifStop1);
+
+ // Now, Stop2 should be connected
+ assertTrue(stop.isStopConnected("Stop2"));
+ }
+
+
+ @Test
+ public void testGetConnectedStop() {
+
+ Stop stop = new Stop("Stop1");
+ BifStop bifStop1 = new BifStop(1, new Stop("Stop2"));
+ BifStop bifStop2 = new BifStop(2, new Stop("Stop3"));
+
+ // Add two connected stops
+ stop.addConnectedStop(bifStop1);
+ stop.addConnectedStop(bifStop2);
+
+ // Retrieve the connected stops
+ BifStop retrievedStop1 = stop.getConnectedStop("Stop2");
+ BifStop retrievedStop2 = stop.getConnectedStop("Stop3");
+
+ // Check if the correct stops were retrieved
+ assertEquals(bifStop1, retrievedStop1);
+ assertEquals(bifStop2, retrievedStop2);
+ }
+
+ @Test
+ public void testAddConnectedStop() {
+ Stop stop = new Stop("Stop1");
+ BifStop bifStop1 = new BifStop(1, new Stop("Stop2"));
+
+ // Add a connected stop
+ stop.addConnectedStop(bifStop1);
+
+ // Check if the stop was added
+ assertTrue(stop.isStopConnected("Stop2"));
+ }
+
+
+ @Test
+ public void testSHJH(){
+ Stop stop = new Stop("Stop2323");
+ BifStop bifStop1 = new BifStop(1, new Stop("Stop2323"));
+
+ // Add a connected stop
+ stop.addConnectedStop(bifStop1);
+
+ // Check if the stop was added
+ assertTrue(stop.isStopConnected("Stop2323"));
+ }
+}
\ No newline at end of file
diff --git a/src/test/java/fr/u_paris/gla/project/idfm/TransportTest.java b/src/test/java/fr/u_paris/gla/project/idfm/TransportTest.java
new file mode 100644
index 0000000..dec50d6
--- /dev/null
+++ b/src/test/java/fr/u_paris/gla/project/idfm/TransportTest.java
@@ -0,0 +1,64 @@
+package fr.u_paris.gla.project.idfm;
+
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import java.util.AbstractMap.SimpleEntry;
+import java.util.List;
+import java.util.ArrayList;
+import static org.junit.jupiter.api.Assertions.*;
+
+public class TransportTest {
+
+ /*@Test
+ public void testRoadToLast() {
+ Transport transport = new Transport("Test Line", "Bus");
+ transport.addStop("A", "B", 1);
+ transport.addStop("B", "C", 2);
+ transport.addStop("C", "D", 3);
+ TraceDescription td = new TraceDescription("A", "D", "A", "D");
+ transport.descriptions.add(td);
+
+ List visited = new ArrayList<>();
+ List bifurcations = new ArrayList<>();
+ SimpleEntry> result = transport.roadToLast("A", "D", visited, bifurcations);
+ assertFalse(result.getKey());
+ assertEquals(List.of(1, 2, 3), result.getValue());
+ }*/
+
+ /*@Test
+ public void testRoadToLastOptimized() {
+ SimpleEntry> result = transport.roadToLastOptimized("A", "D", new HashSet<>(), new ArrayList<>());
+ assertTrue(result.getKey());
+ assertEquals(List.of(1, 2, 3), result.getValue());
+ }*/
+
+ @Test
+ public void testIsTerminus() {
+ Transport transport = new Transport("Test Line", "Bus");
+ transport.addStop("A", "B", 1);
+ transport.addStop("B", "C", 2);
+ transport.addStop("C", "D", 3);
+ TraceDescription td = new TraceDescription("A", "D", "A", "D");
+ transport.descriptions.add(td);
+
+ assertTrue(transport.isTerminus("A"));
+ assertTrue(transport.isTerminus("D"));
+ assertFalse(transport.isTerminus("B"));
+ }
+
+ @Test
+ public void testAddStop() {
+ Transport transport = new Transport("Test Line", "Bus");
+ transport.addStop("A", "B", 1);
+ transport.addStop("B", "C", 2);
+ transport.addStop("C", "D", 3);
+ TraceDescription td = new TraceDescription("A", "D", "A", "D");
+ transport.descriptions.add(td);
+
+ transport.addStop("D", "E", 4);
+ assertTrue(transport.stopsMap.containsKey("E"));
+ assertEquals("E", transport.stopsMap.get("E").name);
+ assertTrue(transport.stopsMap.get("D").isStopConnected("E"));
+ }
+}
\ No newline at end of file
diff --git a/src/test/java/fr/u_paris/gla/project/io/NetworkFormatTest.java b/src/test/java/fr/u_paris/gla/project/io/NetworkFormatTest.java
index a46f12d..4422575 100644
--- a/src/test/java/fr/u_paris/gla/project/io/NetworkFormatTest.java
+++ b/src/test/java/fr/u_paris/gla/project/io/NetworkFormatTest.java
@@ -17,30 +17,30 @@ class NetworkFormatTest {
NumberFormat GPS_test = NetworkFormat.getGPSFormatter();
@Test
- void parseDurationEqual() {
+ public void testParseDurationEqual() {
assertEquals(Duration.ZERO, NetworkFormat.parseDuration(t));
}
@Test
- void parseDurationTooBig() {
+ public void testParseDurationTooBig() {
String y = "119:00";
assertThrows(DateTimeParseException.class, () -> NetworkFormat.parseDuration(y));
}
@Test
- void formatDuration() {
+ public void formatDuration() {
assertEquals(t, NetworkFormat.formatDuration(Duration.ZERO));
}
@Test
- void parseThenFormatDuration(){
+ public void parseThenFormatDuration(){
String t = "00:00";
assertEquals(t, NetworkFormat.formatDuration(NetworkFormat.parseDuration(t)));
}
@Test
- void getGPSFormatterPos() {
+ public void getGPSFormatterPos() {
double GPS_pos = 1.456489615649813;
assertEquals(String.valueOf(GPS_pos), GPS_test.format(GPS_pos));
@@ -48,14 +48,14 @@ class NetworkFormatTest {
}
@Test
- void getGPSFormatterNeg() {
+ public void getGPSFormatterNeg() {
double GPS_neg = -1.456489615649813;
assertEquals(String.valueOf(GPS_neg), GPS_test.format(GPS_neg));
}
@Test
- void getGPSFormatterNul() {
+ public void getGPSFormatterNul() {
int GPS_nul = 0;
assertEquals(String.valueOf(GPS_nul), GPS_test.format(GPS_nul));
@@ -63,7 +63,7 @@ class NetworkFormatTest {
}
@Test
- void getGPSFormatterBig() {
+ public void getGPSFormatterBig() {
String string_int = "4565156498156489";
String string_float = "5675747274674276474267479751262167";
BigDecimal GPS_big = new BigDecimal(string_int + "." + string_float);
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
index f9eae35..152ffd9 100644
--- a/src/test/java/fr/u_paris/gla/project/io/ScheduleFormatTest.java
+++ b/src/test/java/fr/u_paris/gla/project/io/ScheduleFormatTest.java
@@ -21,7 +21,7 @@ class ScheduleFormatTest {
}
@Test
- void getTimeFormatter() {
+ public void getTimeFormatter() {
DateTimeFormatter formatter = ScheduleFormat.getTimeFormatter();
LocalDateTime date = LocalDateTime.now();
String test = date.format(formatter);
diff --git a/src/test/java/fr/u_paris/gla/project/utils/CSVToolsTest.java b/src/test/java/fr/u_paris/gla/project/utils/CSVToolsTest.java
index 949a97f..e40bca4 100644
--- a/src/test/java/fr/u_paris/gla/project/utils/CSVToolsTest.java
+++ b/src/test/java/fr/u_paris/gla/project/utils/CSVToolsTest.java
@@ -17,7 +17,7 @@ class CSVToolsTest {
@Test
- void readCSVFromURL_invalid() {
+ public void readCSVFromURL_invalid() {
// TODO Fix the exception thrown
/**
assertThrows(IOException.class,() -> {
@@ -31,7 +31,7 @@ class CSVToolsTest {
}
@Test
- void readCSVFromURL_valid() {
+ public void testreadCSVFromURL_valid() {
assertDoesNotThrow(() -> {
Consumer test = s -> System.out.println(Arrays.toString(s));
CSVTools.readCSVFromURL("https://people.sc.fsu.edu/~jburkardt/data/csv/addresses.csv",
diff --git a/src/test/java/fr/u_paris/gla/project/utils/GPSTest.java b/src/test/java/fr/u_paris/gla/project/utils/GPSTest.java
index de63357..ed1dc45 100644
--- a/src/test/java/fr/u_paris/gla/project/utils/GPSTest.java
+++ b/src/test/java/fr/u_paris/gla/project/utils/GPSTest.java
@@ -8,7 +8,7 @@ class GPSTest {
@Test
- void distance_SameLat(){
+ public void testDistance_SameLat(){
assertDoesNotThrow(
() -> {
GPS.distance(5, 3, 5, 11);
@@ -17,7 +17,7 @@ class GPSTest {
}
@Test
- void distance_SameLon(){
+ public void distance_SameLon(){
assertDoesNotThrow(
() -> {
GPS.distance(5, 3, 7, 3);
@@ -26,12 +26,12 @@ class GPSTest {
}
@Test
- void distance_SamePoint() {
+ public void distance_SamePoint() {
assertEquals(0.0, GPS.distance(5, 3, 5, 3) );
}
@Test
- void distance_NegativePoint(){
+ public void distance_NegativePoint(){
assertNotEquals(0.0, GPS.distance(-5, 7, -13, 4));
}