From 89fb421bb50541cb3a2c2a07d53a718291cf74a1 Mon Sep 17 00:00:00 2001
From: Javier Calvo <javiercalvoporro@gmail.com>
Date: Sat, 21 Dec 2024 21:03:38 +0100
Subject: [PATCH] SimpleTest realizado

---
 uses/es/markse/PackCamionBarcoTest.java |   7 +-
 uses/es/markse/SimpleTest.java          | 145 ++++++++++++++++++++++++
 2 files changed, 149 insertions(+), 3 deletions(-)
 create mode 100644 uses/es/markse/SimpleTest.java

diff --git a/uses/es/markse/PackCamionBarcoTest.java b/uses/es/markse/PackCamionBarcoTest.java
index 5075bf0..234b5ca 100644
--- a/uses/es/markse/PackCamionBarcoTest.java
+++ b/uses/es/markse/PackCamionBarcoTest.java
@@ -1,5 +1,5 @@
 /**
- * 
+ *Copyright UVa 2024/2025 
  */
 package es.markse;
 
@@ -12,8 +12,9 @@ import es.uva.inf.poo.maps.GPSCoordinate;
 import es.markse.Muelle.estado;
 
 /**
- * @author Javier
- *
+ * Implementacion de los test para PackCamionBarco
+ * @author javcalv
+ * @author victorm
  */
 public class PackCamionBarcoTest {
 
diff --git a/uses/es/markse/SimpleTest.java b/uses/es/markse/SimpleTest.java
new file mode 100644
index 0000000..81b2f64
--- /dev/null
+++ b/uses/es/markse/SimpleTest.java
@@ -0,0 +1,145 @@
+/**
+ * Copyright UVa 2024/2025
+ */
+package es.markse;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+import es.markse.Muelle.estado;
+import es.uva.inf.poo.maps.GPSCoordinate;
+
+/**
+ * Implementcaion de los test para la clase Simple
+ * @author javcalv
+ * @author victorm
+ *
+ */
+public class SimpleTest {
+
+	@Test
+	public void testSimple() {
+		Muelle muelleOrigen = new Muelle("01", new GPSCoordinate(10.0, 15.0), estado.OPERATIVO, 10, 3, true, false);
+		Muelle muelleDestino = new Muelle("02",  new GPSCoordinate(15.0, -15.0), estado.OPERATIVO, 10, 3, true, false);
+		Puerto puertoOrigen = new Puerto("ES", "BAR");
+		Puerto puertoDestino = new Puerto("ES", "VAL");
+		puertoOrigen.anyadirMuelle(muelleOrigen);
+		puertoDestino.anyadirMuelle(muelleDestino);
+		Fecha fechaInicioTrayecto = new Fecha(20, 10, 2015);
+		Fecha fechaFinTrayecto = new Fecha(30, 10, 2015);
+		TBarco tb = new TBarco(muelleOrigen, puertoOrigen, fechaInicioTrayecto, muelleDestino, puertoDestino, fechaFinTrayecto);
+		assertFalse(tb.getMuelleOrigen().alejadoBarco());
+		assertEquals(tb.getPuertoDestino().identificadorPuerto(), "ES-VAL");
+	}
+	
+	@Test (expected = IllegalArgumentException.class)
+	public void testSimpleMuellesYPuertosIguales() {
+		Muelle muelleOrigen = new Muelle("01", new GPSCoordinate(10.0, 15.0), estado.OPERATIVO, 10, 3, true, false);
+		Muelle muelleDestino = new Muelle("01",  new GPSCoordinate(15.0, -15.0), estado.OPERATIVO, 10, 3, true, false);
+		Puerto puertoOrigen = new Puerto("ES", "BAR");
+		Puerto puertoDestino = new Puerto("ES", "BAR");
+		puertoOrigen.anyadirMuelle(muelleOrigen);
+		puertoDestino.anyadirMuelle(muelleDestino);
+		Fecha fechaInicioTrayecto = new Fecha(20, 10, 2015);
+		Fecha fechaFinTrayecto = new Fecha(30, 10, 2015);
+		new TBarco(muelleOrigen, puertoOrigen, fechaInicioTrayecto, muelleDestino, puertoDestino, fechaFinTrayecto);
+	}
+	
+	@Test (expected = IllegalStateException.class)
+	public void testTBarcoMuelleOrigenAlejadoBarco() {
+		Muelle muelleOrigen = new Muelle("01", new GPSCoordinate(10.0, 15.0), estado.OPERATIVO, 10, 3, true, true);
+		Muelle muelleDestino = new Muelle("02",  new GPSCoordinate(15.0, -15.0), estado.OPERATIVO, 10, 3, true, false);
+		Puerto puertoOrigen = new Puerto("ES", "BAR");
+		Puerto puertoDestino = new Puerto("ES", "VAL");
+		puertoOrigen.anyadirMuelle(muelleOrigen);
+		puertoDestino.anyadirMuelle(muelleDestino);
+		Fecha fechaInicioTrayecto = new Fecha(20, 10, 2015);
+		Fecha fechaFinTrayecto = new Fecha(30, 10, 2015);
+		new TBarco(muelleOrigen, puertoOrigen, fechaInicioTrayecto, muelleDestino, puertoDestino, fechaFinTrayecto);	
+	}
+	
+	@Test (expected = IllegalStateException.class)
+	public void testTBarcoMuelleDestinoAlejadoBarco() {
+		Muelle muelleOrigen = new Muelle("01", new GPSCoordinate(10.0, 15.0), estado.OPERATIVO, 10, 3, true, false);
+		Muelle muelleDestino = new Muelle("02",  new GPSCoordinate(15.0, -15.0), estado.OPERATIVO, 10, 3, true, true);
+		Puerto puertoOrigen = new Puerto("ES", "BAR");
+		Puerto puertoDestino = new Puerto("ES", "VAL");
+		puertoOrigen.anyadirMuelle(muelleOrigen);
+		puertoDestino.anyadirMuelle(muelleDestino);
+		Fecha fechaInicioTrayecto = new Fecha(20, 10, 2015);
+		Fecha fechaFinTrayecto = new Fecha(30, 10, 2015);
+		new TBarco(muelleOrigen, puertoOrigen, fechaInicioTrayecto, muelleDestino, puertoDestino, fechaFinTrayecto);	
+	}
+	
+	@Test
+	public void testTBarcoCosteTrayecto() {
+		Muelle muelleOrigen = new Muelle("01", new GPSCoordinate(10.0, 15.0), estado.OPERATIVO, 10, 3, true, false);
+		Muelle muelleDestino = new Muelle("02",  new GPSCoordinate(15.0, -15.0), estado.OPERATIVO, 10, 3, true, false);
+		Puerto puertoOrigen = new Puerto("ES", "BAR");
+		Puerto puertoDestino = new Puerto("ES", "VAL");
+		puertoOrigen.anyadirMuelle(muelleOrigen);
+		puertoDestino.anyadirMuelle(muelleDestino);
+		Fecha fechaInicioTrayecto = new Fecha(20, 10, 2015);
+		Fecha fechaFinTrayecto = new Fecha(30, 10, 2015);
+		TBarco tb = new TBarco(muelleOrigen, puertoOrigen, fechaInicioTrayecto, muelleDestino, puertoDestino, fechaFinTrayecto);
+		assertEquals(tb.costeTrayecto(),44000, 0.01f);
+	}
+	
+	@Test
+	public void testTTren() {
+		Muelle muelleOrigen = new Muelle("01", new GPSCoordinate(10.0, 15.0), estado.OPERATIVO, 10, 3, true, false);
+		Muelle muelleDestino = new Muelle("02",  new GPSCoordinate(15.0, -15.0), estado.OPERATIVO, 10, 3, true, false);
+		Puerto puertoOrigen = new Puerto("ES", "BAR");
+		Puerto puertoDestino = new Puerto("ES", "VAL");
+		puertoOrigen.anyadirMuelle(muelleOrigen);
+		puertoDestino.anyadirMuelle(muelleDestino);
+		Fecha fechaInicioTrayecto = new Fecha(20, 10, 2015);
+		Fecha fechaFinTrayecto = new Fecha(30, 10, 2015);
+		TTren tt = new TTren(muelleOrigen, puertoOrigen, fechaInicioTrayecto, muelleDestino, puertoDestino, fechaFinTrayecto);
+		assertEquals(tt.getMuelleDestino().getIdentificador(), "02");
+	}
+	
+	@Test (expected = IllegalStateException.class)
+	public void testTTrenMuelleOrigenUtilidadTrenFalsa() {
+		Muelle muelleOrigen = new Muelle("01", new GPSCoordinate(10.0, 15.0), estado.OPERATIVO, 10, 3, false, false);
+		Muelle muelleDestino = new Muelle("02",  new GPSCoordinate(15.0, -15.0), estado.OPERATIVO, 10, 3, true, false);
+		Puerto puertoOrigen = new Puerto("ES", "BAR");
+		Puerto puertoDestino = new Puerto("ES", "VAL");
+		puertoOrigen.anyadirMuelle(muelleOrigen);
+		puertoDestino.anyadirMuelle(muelleDestino);
+		Fecha fechaInicioTrayecto = new Fecha(20, 10, 2015);
+		Fecha fechaFinTrayecto = new Fecha(30, 10, 2015);
+		new TTren(muelleOrigen, puertoOrigen, fechaInicioTrayecto, muelleDestino, puertoDestino, fechaFinTrayecto);
+	}
+	
+	@Test (expected = IllegalStateException.class)
+	public void testTTrenMuelleDestinoUtilidadTrenFalsa() {
+		Muelle muelleOrigen = new Muelle("01", new GPSCoordinate(10.0, 15.0), estado.OPERATIVO, 10, 3, true, false);
+		Muelle muelleDestino = new Muelle("02",  new GPSCoordinate(15.0, -15.0), estado.OPERATIVO, 10, 3, false, false);
+		Puerto puertoOrigen = new Puerto("ES", "BAR");
+		Puerto puertoDestino = new Puerto("ES", "VAL");
+		puertoOrigen.anyadirMuelle(muelleOrigen);
+		puertoDestino.anyadirMuelle(muelleDestino);
+		Fecha fechaInicioTrayecto = new Fecha(20, 10, 2015);
+		Fecha fechaFinTrayecto = new Fecha(30, 10, 2015);
+		new TTren(muelleOrigen, puertoOrigen, fechaInicioTrayecto, muelleDestino, puertoDestino, fechaFinTrayecto);
+	}
+	
+	@Test
+	public void testTCamion() {
+		Muelle muelleOrigen = new Muelle("01", new GPSCoordinate(10.0, 15.0), estado.OPERATIVO, 10, 3, true, false);
+		Muelle muelleDestino = new Muelle("02",  new GPSCoordinate(15.0, -15.0), estado.OPERATIVO, 10, 3, false, false);
+		Puerto puertoOrigen = new Puerto("ES", "BAR");
+		Puerto puertoDestino = new Puerto("ES", "VAL");
+		puertoOrigen.anyadirMuelle(muelleOrigen);
+		puertoDestino.anyadirMuelle(muelleDestino);
+		Fecha fechaInicioTrayecto = new Fecha(20, 10, 2015);
+		Fecha fechaFinTrayecto = new Fecha(30, 10, 2015);
+		TCamion tc = new TCamion(muelleOrigen, puertoOrigen, fechaInicioTrayecto, muelleDestino, puertoDestino, fechaFinTrayecto);
+		assertEquals(tc.getMuelleOrigen().getIdentificador(), "01");
+	}
+
+	
+
+}
-- 
GitLab