diff --git a/uses/es/markse/TrayectoTest.java b/uses/es/markse/TrayectoTest.java index a21c952a160ae9f7ce289e15c12212b50daa2f39..2c0e2d2d6a70fceef1b8d18be890cfe2b295ed99 100644 --- a/uses/es/markse/TrayectoTest.java +++ b/uses/es/markse/TrayectoTest.java @@ -213,23 +213,6 @@ public class TrayectoTest { Fecha f2 = null; new Trayecto(m1,p1,f1,m2,p2,f2); } - - - @Test(expected = IllegalArgumentException.class) - public void testPrecioTrayectoEnEuros() { - GPSCoordinate c1 = new GPSCoordinate(5d,5d); - GPSCoordinate c2 = new GPSCoordinate(10d,10d); - Muelle m1 = new Muelle ("01",c1,true,2,2); - Muelle m2 = new Muelle ("02",c2,false,2,2); - Puerto p1 = new Puerto ("ES","PAL"); - Puerto p2 = new Puerto ("ES","VAL"); - p1.anyadirMuelle(m1); - p2.anyadirMuelle(m2); - Fecha f1 = new Fecha (1,11,1999); - Fecha f2 = new Fecha (30,12,2000); - Trayecto t = new Trayecto (m1,p1,f1,m2,p2,f2); - t.precioTrayectoEnEuros(2,0); - } @Test public void testFechaFinTrayectoSuperior() { @@ -281,4 +264,65 @@ public class TrayectoTest { double v = 781.1062793857914; assertEquals(v, t.distanciaMillasMarinas(), 0.001); } + + @Test + public void testprecioTrayectoEurosBien() { + GPSCoordinate c1 = new GPSCoordinate(5d,5d); + GPSCoordinate c2 = new GPSCoordinate(10d,10d); + Muelle m1 = new Muelle ("01",c1,true,2,2); + Muelle m2 = new Muelle ("01",c2,true,2,2); + Puerto p1 = new Puerto ("ES","BAR"); + Puerto p2 = new Puerto ("AR","BUE"); + p1.anyadirMuelle(m1); + p2.anyadirMuelle(m2); + Fecha f1 = new Fecha (9,11,2024); + Fecha f2 = new Fecha(11,11,2024); + Trayecto t = new Trayecto(m1,p1,f1,m2,p2,f2); + t.precioTrayectoEnEuros(5,5); + } + @Test(expected = IllegalArgumentException.class) + public void testprecioTrayectoEurosMalPrimero() { + GPSCoordinate c1 = new GPSCoordinate(5d,5d); + GPSCoordinate c2 = new GPSCoordinate(10d,10d); + Muelle m1 = new Muelle ("01",c1,true,2,2); + Muelle m2 = new Muelle ("01",c2,true,2,2); + Puerto p1 = new Puerto ("ES","BAR"); + Puerto p2 = new Puerto ("AR","BUE"); + p1.anyadirMuelle(m1); + p2.anyadirMuelle(m2); + Fecha f1 = new Fecha (9,11,2024); + Fecha f2 = new Fecha(11,11,2024); + Trayecto t = new Trayecto(m1,p1,f1,m2,p2,f2); + t.precioTrayectoEnEuros(0,5); + } + @Test(expected = IllegalArgumentException.class) + public void testprecioTrayectoEurosMalSegundo() { + GPSCoordinate c1 = new GPSCoordinate(5d,5d); + GPSCoordinate c2 = new GPSCoordinate(10d,10d); + Muelle m1 = new Muelle ("01",c1,true,2,2); + Muelle m2 = new Muelle ("01",c2,true,2,2); + Puerto p1 = new Puerto ("ES","BAR"); + Puerto p2 = new Puerto ("AR","BUE"); + p1.anyadirMuelle(m1); + p2.anyadirMuelle(m2); + Fecha f1 = new Fecha (9,11,2024); + Fecha f2 = new Fecha(11,11,2024); + Trayecto t = new Trayecto(m1,p1,f1,m2,p2,f2); + t.precioTrayectoEnEuros(5,0); + } + @Test + public void testinforTrayecto() { + GPSCoordinate c1 = new GPSCoordinate(5d,5d); + GPSCoordinate c2 = new GPSCoordinate(10d,10d); + Muelle m1 = new Muelle ("01",c1,true,2,2); + Muelle m2 = new Muelle ("01",c2,true,2,2); + Puerto p1 = new Puerto ("ES","BAR"); + Puerto p2 = new Puerto ("AR","BUE"); + p1.anyadirMuelle(m1); + p2.anyadirMuelle(m2); + Fecha f1 = new Fecha (9,11,2024); + Fecha f2 = new Fecha(11,11,2024); + Trayecto t = new Trayecto(m1,p1,f1,m2,p2,f2); + t.inforTrayecto(); + } } \ No newline at end of file