From 7819791a7ea8556e6f0a5cf9dca6d7f792b708e4 Mon Sep 17 00:00:00 2001 From: Javier Calvo <javiercalvoporro@gmail.com> Date: Sun, 22 Dec 2024 19:16:56 +0100 Subject: [PATCH] Teste realizados. Falta CombinadoTest --- src/es/markse/Contenedor.java | 6 +- src/es/markse/Estandar.java | 17 +- src/es/markse/FlatRack.java | 20 +- src/es/markse/PackCamionBarco.java | 2 +- src/es/markse/PackCamionTren.java | 4 +- src/es/markse/Refrigerado.java | 36 ++- src/es/markse/Simple.java | 1 - src/es/markse/TVehiculoTierra.java | 2 +- src/es/markse/Trayecto.java | 23 +- uses/es/markse/CombinadoTest.java | 171 ++++++++++ uses/es/markse/ContenedorTest.java | 501 +++++++++++++++++++---------- uses/es/markse/TrayectoTest.java | 474 +++++++++++++++------------ 12 files changed, 824 insertions(+), 433 deletions(-) create mode 100644 uses/es/markse/CombinadoTest.java diff --git a/src/es/markse/Contenedor.java b/src/es/markse/Contenedor.java index 4a3c44e..3ab7319 100644 --- a/src/es/markse/Contenedor.java +++ b/src/es/markse/Contenedor.java @@ -44,7 +44,7 @@ public abstract class Contenedor { * @param techo indica si tiene techo (true) o no (false) */ public Contenedor(ISO6346 codigo, float pesoTara, float maximaCargaUtil, float volumen, estados estadoActual, pesos pesoSeleccionado, volumenes volumenSeleccionado) { - if (pesoTara<=0 || maximaCargaUtil <=0 || volumen<=0) + if (pesoTara<1 || maximaCargaUtil <1 || volumen<1) throw new IllegalArgumentException("Los pesos no puedne ser menores a 0"); this.codigo = codigo; @@ -133,9 +133,6 @@ public abstract class Contenedor { */ public abstract void anyadirTrayecto(Trayecto t); - - - protected void comprobarDatosContenedor(Trayecto t) { Trayecto ultimoT = this.trayectos.get(this.trayectos.size() -1); //Si la fecha fin es mayor a la de inicio del nuevo @@ -150,7 +147,6 @@ public abstract class Contenedor { this.trayectos.add(t); } - /** * Metodo que devuelve si un contenedor tiene techo * @return si tiene techo (true) o si no lo tiene (false) diff --git a/src/es/markse/Estandar.java b/src/es/markse/Estandar.java index 7ed6d1b..b1deb1b 100644 --- a/src/es/markse/Estandar.java +++ b/src/es/markse/Estandar.java @@ -12,28 +12,35 @@ public class Estandar extends Contenedor { this.techo = techo; } - + /** + * Metodo que agrega un nuevo trayecto al contenedor + * @param t Trayecto que se agrega + * @throws IllegalArgumentException si el trayecto es nulo + */ @Override public void anyadirTrayecto(Trayecto t) { if (t==null) { throw new IllegalArgumentException("El Trayecto no puede ser nulo"); } if (this.trayectos.isEmpty()) { - this.anyadirTrayecto(t); + this.trayectos.add(t); } else { comprobarDatosContenedor(t); } - } + + /** + * Metodo para alternar el techo de un contenedor + * @return True si tiene techo o false si no lo tiene + */ public void alternarTecho() { this.techo=!this.techo; } + @Override public boolean tieneTecho() { return this.techo; } - - } diff --git a/src/es/markse/FlatRack.java b/src/es/markse/FlatRack.java index 4750c7f..69ef5a4 100644 --- a/src/es/markse/FlatRack.java +++ b/src/es/markse/FlatRack.java @@ -13,6 +13,14 @@ public class FlatRack extends Contenedor{ } + /** + * Metodo que agrega un trayecto al contenedor + * @param t trayecto a agregar + * @throws IllegalArgumentException Si el trayecto es nulo + * @throws IllegalArgumentException Si el trayecto es desde un Camion + * @throws IllegalArgumentException Si el trayecto es un pack de camion-tren + * @throws IllegalArgumentException Si el trayecto es un pack de camion-barco + */ @Override public void anyadirTrayecto(Trayecto t) { if (t==null) { @@ -31,12 +39,16 @@ public class FlatRack extends Contenedor{ throw new IllegalArgumentException("No puede ser transportado en Camion"); } - comprobarDatosContenedor(t); + if (this.trayectos.isEmpty()) this.trayectos.add(t); + else comprobarDatosContenedor(t); } @Override + /** + * metodo que devuelve si el FlatRack tiene techo + * @return false + */ public boolean tieneTecho() { return false; - } - -} + } +} \ No newline at end of file diff --git a/src/es/markse/PackCamionBarco.java b/src/es/markse/PackCamionBarco.java index 9edad8f..e484ccf 100644 --- a/src/es/markse/PackCamionBarco.java +++ b/src/es/markse/PackCamionBarco.java @@ -90,7 +90,7 @@ public class PackCamionBarco extends Combinado { * @return Coste del trayecto en euros */ @Override - public double costeTrayecto() { + protected double costeTrayecto() { double coste = 0; for (Simple ts: this.trayectosSimples) { if (ts instanceof TBarco) { diff --git a/src/es/markse/PackCamionTren.java b/src/es/markse/PackCamionTren.java index 4a5e2d6..f0ef2a0 100644 --- a/src/es/markse/PackCamionTren.java +++ b/src/es/markse/PackCamionTren.java @@ -39,7 +39,7 @@ public class PackCamionTren extends Combinado { throw new IllegalArgumentException("Los trayectos no pueden ser nulos/vacios"); //Comprobamos si las clases son solo de tipo Camion o Tren - if (trayectosCorrectos(trayectosSimples)) + if (!trayectosCorrectos(trayectosSimples)) throw new IllegalArgumentException("Las clases agregadas al ArrayList son invalidas"); //Comprobar si hay un trayecto de barco y de camion al menos (Obligatorio por nuestra parte) @@ -95,7 +95,7 @@ public class PackCamionTren extends Combinado { * @return Coste del trayecto en euros */ @Override - public double costeTrayecto() { + protected double costeTrayecto() { double coste = 0; for (Simple ts : this.trayectosSimples) { TVehiculoTierra tv = (TVehiculoTierra) ts; diff --git a/src/es/markse/Refrigerado.java b/src/es/markse/Refrigerado.java index 30bb7d4..e195ef2 100644 --- a/src/es/markse/Refrigerado.java +++ b/src/es/markse/Refrigerado.java @@ -12,31 +12,35 @@ public class Refrigerado extends Contenedor{ this.techo=true; } + + /** + * Metodo que añade un trayecto al contenedor + * @param t trayecto a agregar + * @throws IllegalArgumentException Si el trayecto es nulo + * @throws IllegalArgumentException Si el trayecto es desde un tren + * @throws IllegalArgumentException Si el trayecto es un pack de camion-tren + */ @Override public void anyadirTrayecto(Trayecto t) { - if (t==null) { + if (t==null) throw new IllegalArgumentException("El trayecto no puede ser nulo"); - } - - if (t instanceof TTren) { - throw new IllegalArgumentException("No puede viajar en tren"); - } + + if (t instanceof TTren) + throw new IllegalArgumentException("Trayecto invalido. No puede viajar en tren"); - if (t instanceof PackCamionTren) { - throw new IllegalArgumentException("No puede viajar en tren"); - } - comprobarDatosContenedor(t); - + if (t instanceof PackCamionTren) + throw new IllegalArgumentException("Trayecto invalido. No puede viajar en tren"); + if(this.trayectos.isEmpty()) this.trayectos.add(t); + else comprobarDatosContenedor(t); } @Override + /** + * Metodo que devuelve si un refrigerado tiene techo + * @return true + */ public boolean tieneTecho() { return true; } - - - - - } \ No newline at end of file diff --git a/src/es/markse/Simple.java b/src/es/markse/Simple.java index 03b8300..b98b15e 100644 --- a/src/es/markse/Simple.java +++ b/src/es/markse/Simple.java @@ -33,7 +33,6 @@ public abstract class Simple extends Trayecto { } - /** * Método que Comprueba si los Muelles Introducidos son Distintos o no * @param muelleOrigen Muelle desde el que comienza el Trayecto diff --git a/src/es/markse/TVehiculoTierra.java b/src/es/markse/TVehiculoTierra.java index 2569c47..44472c5 100644 --- a/src/es/markse/TVehiculoTierra.java +++ b/src/es/markse/TVehiculoTierra.java @@ -18,7 +18,7 @@ public abstract class TVehiculoTierra extends Simple{ * @return Coste del trayecto en euros */ @Override - public double costeTrayecto() { + protected double costeTrayecto() { return COSTE_FIJO + (this.distanciaKilometros * COSTE_POR_KILOMETRO); } diff --git a/src/es/markse/Trayecto.java b/src/es/markse/Trayecto.java index bdc62e7..39a3af5 100644 --- a/src/es/markse/Trayecto.java +++ b/src/es/markse/Trayecto.java @@ -50,10 +50,6 @@ public abstract class Trayecto{ if(fechaInicioTrayecto.getDiasDesdeEpoch()>fechaFinTrayecto.getDiasDesdeEpoch()) throw new IllegalArgumentException ("La Fecha del Inicio del Trayecto no puede ser posterior a la fecha del Fin del Trayecto"); - - if (!comprobacionMuellesDistintos(muelleOrigen, muelleDestino, puertoOrigen, puertoDestino)) - throw new IllegalArgumentException("El muelle de origen no puede ser igual al de destino"); - this.muelleOrigen=muelleOrigen; this.puertoOrigen=puertoOrigen; this.fechaInicioTrayecto=fechaInicioTrayecto; @@ -62,17 +58,6 @@ public abstract class Trayecto{ this.fechaFinTrayecto = fechaFinTrayecto; } - /** - * Método que Comprueba si los Muelles Introducidos son Distintos o no - * @param muelleOrigen Muelle desde el que comienza el Trayecto - * @param muelleDestino Muelle en el que finaliza el Trayecto - * @return true si los muelles son distintos o false si son los mismos - */ - private boolean comprobacionMuellesDistintos(Muelle muelleOrigen, Muelle muelleDestino, Puerto puertoOrigen, Puerto puertoDestino) { - return (muelleOrigen.getIdentificador() == muelleDestino.getIdentificador() && - puertoOrigen.identificadorPuerto().equals(puertoDestino.identificadorPuerto())) ? false : true; - } - /********************************************* * IMPLEMENTACION DE FUNCIONALIDADES BASICAS * *********************************************/ @@ -81,16 +66,12 @@ public abstract class Trayecto{ * 1.1.21 Método que indica si la Fecha de Fin de Trayecto es superior a una Fecha Dada * @param fechaDada Fecha de Introducida por el usuario * @return True si la Fecha de Fin de Trayecto es Superior, y False si la Fecha de Fin de Trayecto no es Superior + * @throws IllegalArgumentException si la fecha es nula */ public boolean FechaFinTrayectoSuperior(Fecha fechaDada) { if (fechaDada == null) throw new IllegalArgumentException("Fecha no puede ser nula"); - if (fechaFinTrayecto.getDiasDesdeEpoch()>fechaDada.getDiasDesdeEpoch()) { - return false; - } - else { - return true; - } + return (fechaFinTrayecto.getDiasDesdeEpoch()>fechaDada.getDiasDesdeEpoch()) ? false : true; } /** diff --git a/uses/es/markse/CombinadoTest.java b/uses/es/markse/CombinadoTest.java new file mode 100644 index 0000000..5bfc7c4 --- /dev/null +++ b/uses/es/markse/CombinadoTest.java @@ -0,0 +1,171 @@ +package es.markse; + +import static org.junit.Assert.*; +import java.util.ArrayList; +import org.junit.Test; +import es.markse.Muelle.estado; +import es.uva.inf.poo.maps.GPSCoordinate; + +public class CombinadoTest{ + + @Test + public void testCombinado() { + 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); + ArrayList<Simple> trayectosSimples = new ArrayList<>(); + Muelle muelleConexion = new Muelle("01", new GPSCoordinate(10.0, -15.0), estado.OPERATIVO, 10, 3, true, false); + Puerto puertoConexion = new Puerto("IT", "NAP"); + puertoConexion.anyadirMuelle(muelleConexion); + Fecha fechaConexion = new Fecha(25,10,2015); + TCamion tc = new TCamion(muelleOrigen, puertoOrigen, fechaInicioTrayecto, muelleConexion, puertoConexion, fechaConexion); + TTren tb = new TTren(muelleConexion,puertoConexion, fechaConexion, muelleDestino, puertoDestino, fechaFinTrayecto); + trayectosSimples.add(tc); + trayectosSimples.add(tb); + new PackCamionTren(muelleOrigen, puertoOrigen, fechaInicioTrayecto, muelleDestino, puertoDestino, fechaFinTrayecto, trayectosSimples); + } + @Test(expected=IllegalArgumentException.class) + public void testEstanVacios() { + 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); + ArrayList<Simple> trayectosSimples = new ArrayList<>(); + Muelle muelleConexion = new Muelle("01", new GPSCoordinate(10.0, -15.0), estado.OPERATIVO, 10, 3, true, false); + Puerto puertoConexion = new Puerto("IT", "NAP"); + puertoConexion.anyadirMuelle(muelleConexion); + Fecha fechaConexion = new Fecha(25,10,2015); + TCamion tc = new TCamion(muelleOrigen, puertoOrigen, fechaInicioTrayecto, muelleConexion, puertoConexion, fechaConexion); + TTren tt = new TTren(muelleConexion,puertoConexion, fechaConexion, muelleDestino, puertoDestino, fechaFinTrayecto); + //trayectosSimples.add(tc); + //trayectosSimples.add(tt); + PackCamionTren pct = new PackCamionTren(muelleOrigen, puertoOrigen, fechaInicioTrayecto, muelleDestino, puertoDestino, fechaFinTrayecto, trayectosSimples); + } + + @Test(expected = IllegalArgumentException.class) + public void testComprobarTrayectoBarco() { + 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); + ArrayList<Simple> trayectosSimples = new ArrayList<>(); + Muelle muelleConexion = new Muelle("01", new GPSCoordinate(10.0, -15.0), estado.OPERATIVO, 10, 3, true, false); + Puerto puertoConexion = new Puerto("IT", "NAP"); + puertoConexion.anyadirMuelle(muelleConexion); + Fecha fechaConexion = new Fecha(25,10,2015); + TCamion tc = new TCamion(muelleOrigen, puertoOrigen, fechaInicioTrayecto, muelleConexion, puertoConexion, fechaConexion); + TBarco tb = new TBarco(muelleConexion,puertoConexion, fechaConexion, muelleDestino, puertoDestino, fechaFinTrayecto); + trayectosSimples.add(tc); + trayectosSimples.add(tb); + new PackCamionTren(muelleOrigen, puertoOrigen, fechaInicioTrayecto, muelleDestino, puertoDestino, fechaFinTrayecto, trayectosSimples); + } + + @Test(expected = IllegalArgumentException.class) + public void testComprobarSiHayTrayectosCamion() { + 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); + ArrayList<Simple> trayectosSimples = new ArrayList<>(); + Muelle muelleConexion = new Muelle("01", new GPSCoordinate(10.0, -15.0), estado.OPERATIVO, 10, 3, true, false); + Puerto puertoConexion = new Puerto("IT", "NAP"); + puertoConexion.anyadirMuelle(muelleConexion); + Fecha fechaConexion = new Fecha(25,10,2015); + TTren tc = new TTren(muelleOrigen, puertoOrigen, fechaInicioTrayecto, muelleConexion, puertoConexion, fechaConexion); + TTren tt = new TTren(muelleConexion,puertoConexion, fechaConexion, muelleDestino, puertoDestino, fechaFinTrayecto); + trayectosSimples.add(tc); + trayectosSimples.add(tt); + PackCamionTren pct = new PackCamionTren(muelleOrigen, puertoOrigen, fechaInicioTrayecto, muelleDestino, puertoDestino, fechaFinTrayecto, trayectosSimples); + } + + + + @Test(expected = IllegalArgumentException.class) + public void testComprobarSiHayTrayectosTren() { + 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); + ArrayList<Simple> trayectosSimples = new ArrayList<>(); + Muelle muelleConexion = new Muelle("01", new GPSCoordinate(10.0, -15.0), estado.OPERATIVO, 10, 3, true, false); + Puerto puertoConexion = new Puerto("IT", "NAP"); + puertoConexion.anyadirMuelle(muelleConexion); + Fecha fechaConexion = new Fecha(25,10,2015); + TCamion tc = new TCamion(muelleOrigen, puertoOrigen, fechaInicioTrayecto, muelleConexion, puertoConexion, fechaConexion); + TCamion tt = new TCamion(muelleConexion,puertoConexion, fechaConexion, muelleDestino, puertoDestino, fechaFinTrayecto); + trayectosSimples.add(tc); + trayectosSimples.add(tt); + PackCamionTren pct = new PackCamionTren(muelleOrigen, puertoOrigen, fechaInicioTrayecto, muelleDestino, puertoDestino, fechaFinTrayecto, trayectosSimples); + } + + @Test(expected = IllegalArgumentException.class) + public void testFechasImposibles() { + Muelle muelleOrigen = new Muelle("02", 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); + ArrayList<Simple> trayectosSimples = new ArrayList<>(); + Muelle muelleConexion = new Muelle("01", new GPSCoordinate(10.0, -15.0), estado.OPERATIVO, 10, 3, true, false); + Puerto puertoConexion = new Puerto("IT", "NAP"); + puertoConexion.anyadirMuelle(muelleConexion); + Fecha fechaConexion = new Fecha(25,10,2015); + TCamion tc = new TCamion(muelleOrigen, puertoOrigen, fechaInicioTrayecto, muelleConexion, puertoConexion, fechaConexion); + TTren tb = new TTren(muelleConexion,puertoConexion, fechaConexion, muelleDestino, puertoDestino, fechaFinTrayecto); + trayectosSimples.add(tc); + trayectosSimples.add(tb); + PackCamionTren pct = new PackCamionTren(muelleOrigen, puertoOrigen, fechaInicioTrayecto, muelleDestino, puertoDestino, fechaFinTrayecto, trayectosSimples); + } + + @Test() + public void testCosteTrayecto() { + 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); + ArrayList<Simple> trayectosSimples = new ArrayList<>(); + Muelle muelleConexion = new Muelle("01", new GPSCoordinate(10.0, -15.0), estado.OPERATIVO, 10, 3, true, false); + Puerto puertoConexion = new Puerto("IT", "NAP"); + + puertoConexion.anyadirMuelle(muelleConexion); + Fecha fechaConexion = new Fecha(25,10,2015); + TCamion tc = new TCamion(muelleOrigen, puertoOrigen, fechaInicioTrayecto, muelleConexion, puertoConexion, fechaConexion); + TTren tb = new TTren(muelleConexion,puertoConexion, fechaConexion, muelleDestino, puertoDestino, fechaFinTrayecto); + trayectosSimples.add(tc); + trayectosSimples.add(tb); + PackCamionTren pct = new PackCamionTren(muelleOrigen, puertoOrigen, fechaInicioTrayecto, muelleDestino, puertoDestino, fechaFinTrayecto, trayectosSimples); + double x =pct.precioTrayectoEnEuros(); + } + + +} + + diff --git a/uses/es/markse/ContenedorTest.java b/uses/es/markse/ContenedorTest.java index f892997..85a3624 100644 --- a/uses/es/markse/ContenedorTest.java +++ b/uses/es/markse/ContenedorTest.java @@ -1,249 +1,416 @@ -/** - * Copyright UVa 2024/2025 - */ package es.markse; import static org.junit.Assert.*; + +import java.util.ArrayList; + import org.junit.Test; -import es.markse.Contenedor.estados; -import es.markse.Contenedor.pesos; -import es.markse.Contenedor.volumenes; +import es.markse.Contenedor.*; import es.markse.Muelle.estado; import es.uva.inf.poo.maps.GPSCoordinate; -/** - * Implementacon de los Test para la clase Contenedor - * @author victorm - * @author javcalv - */ public class ContenedorTest { + @Test (expected = IllegalArgumentException.class) + public final void testContenedorPesoTaraInvalida() { + ISO6346 iso = new ISO6346("ZTE", 'J', 458971); + new Estandar(iso, 0, 500, 1000, estados.REGOGIDA, pesos.KILOS, volumenes.METROS, true); + } + + @Test (expected = IllegalArgumentException.class) + public final void testContenedorMaximaCargaInvalida() { + ISO6346 iso = new ISO6346("ZTE", 'J', 458971); + new Estandar(iso, 200, 0, 1000, estados.REGOGIDA, pesos.KILOS, volumenes.METROS, true); + } + + @Test (expected = IllegalArgumentException.class) + public final void testContenedorVolumenInvalida() { + ISO6346 iso = new ISO6346("ZTE", 'J', 458971); + new Estandar(iso, 200, 500, 0, estados.REGOGIDA, pesos.KILOS, volumenes.METROS, true); + } + @Test - public void testContenedor() { - ISO6346 i1 = new ISO6346("ZRE", 'J', 56731); - Contenedor c1 = new Estandar(i1, 100, 400, 500, estados.REGOGIDA, pesos.KILOS, volumenes.METROS, true); - assertEquals("ZREJ0567310", c1.getCodigo()); - assertEquals(100.0f, c1.obtenerPesoKilos(), 0.001f); - assertEquals(400.0f, c1.cargaUtilContenedorKilos(), 0.001f); - assertEquals(500.0f, c1.volumenEnMetrosCubicos(), 0.001f); + public final void testContenedorEstandar() { + ISO6346 iso = new ISO6346("ZTE", 'J', 458971); + Estandar e = new Estandar(iso, 200, 500, 1000, estados.REGOGIDA, pesos.KILOS, volumenes.METROS, true); + assertTrue(e.tieneTecho()); } - @Test(expected = IllegalArgumentException.class) - public void testContenedorTaraInvalida(){ - ISO6346 i1 = new ISO6346("ZRE", 'J', 56731); - new Contenedor(i1, -0.54f, 400, 500, estados.REGOGIDA, pesos.KILOS, volumenes.METROS, true); + @Test + public final void testContenedorEstandarAlternarTecho() { + ISO6346 iso = new ISO6346("ZTE", 'J', 458971); + Estandar e = new Estandar(iso, 200, 500, 1000, estados.REGOGIDA, pesos.KILOS, volumenes.METROS, true); + assertTrue(e.tieneTecho()); + e.alternarTecho(); + assertFalse(e.tieneTecho()); + e.alternarTecho(); + assertTrue(e.tieneTecho()); } - @Test(expected = IllegalArgumentException.class) - public void testContenedorCargaInvalida(){ - ISO6346 i1 = new ISO6346("ZRE", 'J', 56731); - new Contenedor(i1, 100, 0, 500, estados.REGOGIDA, pesos.KILOS, volumenes.METROS, true); + @Test + public final void testContenedorEstandarAgregarTrayecto() { + ISO6346 iso = new ISO6346("ZTE", 'J', 458971); + Estandar e = new Estandar(iso, 200, 500, 1000, estados.REGOGIDA, pesos.KILOS, volumenes.METROS, true); + 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); + TBarco tb = new TBarco(muelleDestino,puertoDestino, fechaFinTrayecto,muelleOrigen,puertoOrigen, fechaFinTrayecto); + e.anyadirTrayecto(tt); + e.anyadirTrayecto(tb); } - @Test(expected = IllegalArgumentException.class) - public void testContenedorVolumenInvalida(){ - ISO6346 i1 = new ISO6346("ZRE", 'J', 56731); - new Contenedor(i1, 100, 400, -0.45f, estados.REGOGIDA, pesos.KILOS, volumenes.METROS, true); + @Test (expected = IllegalArgumentException.class) + public final void testContenedorEstandarAgregarTrayectoNulo() { + ISO6346 iso = new ISO6346("ZTE", 'J', 458971); + Estandar e = new Estandar(iso, 200, 500, 1000, estados.REGOGIDA, pesos.KILOS, volumenes.METROS, true); + e.anyadirTrayecto(null); } @Test - public final void testCambiarEstadoARecogida() { - ISO6346 i = new ISO6346("ZRE", 'J', 56731); - Contenedor c = new Contenedor(i, 100, 400, 500, estados.TRANSITO, pesos.KILOS, volumenes.METROS, true); - assertFalse(c.contenedorEnRecogida()); - c.cambiarEstadoARecogida(); - assertTrue(c.contenedorEnRecogida()); + public final void testContenedorRefrigerado() { + ISO6346 iso = new ISO6346("ZTE", 'J', 458971); + Refrigerado r = new Refrigerado(iso, 200, 500, 1000, estados.REGOGIDA, pesos.KILOS, volumenes.METROS); + assertTrue(r.tieneTecho()); } @Test - public final void testCambiarEstadoATransito() { - ISO6346 i = new ISO6346("ZRE", 'J', 56731); - Contenedor c = new Contenedor(i, 100, 400, 500, estados.REGOGIDA, pesos.KILOS, volumenes.METROS, true); - assertFalse(c.contenedorEnTransito()); - c.cambiarEstadoATransito(); - assertTrue(c.contenedorEnTransito()); + public final void testContenedorRefrigeradoAgregarTrayecto() { + ISO6346 iso = new ISO6346("ZTE", 'J', 458971); + Refrigerado r = new Refrigerado(iso, 200, 500, 1000, estados.REGOGIDA, pesos.KILOS, volumenes.METROS); + 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); + TBarco tb2 = new TBarco(muelleDestino, puertoDestino, fechaFinTrayecto, muelleOrigen, puertoOrigen, fechaFinTrayecto); + r.anyadirTrayecto(tb); + r.anyadirTrayecto(tb2); + } + + @Test (expected = IllegalArgumentException.class) + public final void testContenedorRefrigeradoAgregarTrayectoNulo() { + ISO6346 iso = new ISO6346("ZTE", 'J', 458971); + Refrigerado r = new Refrigerado(iso, 200, 500, 1000, estados.REGOGIDA, pesos.KILOS, volumenes.METROS); + r.anyadirTrayecto(null); + } + + @Test (expected = IllegalArgumentException.class) + public final void testContenedorRefrigeradoAgregarTrayectoTren() { + ISO6346 iso = new ISO6346("ZTE", 'J', 458971); + Refrigerado r = new Refrigerado(iso, 200, 500, 1000, estados.REGOGIDA, pesos.KILOS, volumenes.METROS); + 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 tb = new TTren(muelleOrigen, puertoOrigen, fechaInicioTrayecto, muelleDestino, puertoDestino, fechaFinTrayecto); + r.anyadirTrayecto(tb); + } + + @Test (expected = IllegalArgumentException.class) + public final void testContenedorRefrigeradoAgregarTrayectoPackCamionTren() { + ISO6346 iso = new ISO6346("ZTE", 'J', 458971); + Refrigerado r = new Refrigerado(iso, 200, 500, 1000, estados.REGOGIDA, pesos.KILOS, volumenes.METROS); + 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); + ArrayList<Simple> trayectosSimples = new ArrayList<>(); + Muelle muelleConexion = new Muelle("03", new GPSCoordinate(10.0, -15.0), estado.OPERATIVO, 10, 3, true, false); + Puerto puertoConexion = new Puerto("IT", "NAP"); + puertoConexion.anyadirMuelle(muelleConexion); + Fecha fechaConexion = new Fecha(25,10,2015); + TCamion tc = new TCamion(muelleOrigen, puertoOrigen, fechaInicioTrayecto, muelleConexion, puertoConexion, fechaConexion); + TTren tt = new TTren(muelleConexion,puertoConexion, fechaConexion, muelleDestino, puertoDestino, fechaFinTrayecto); + trayectosSimples.add(tc); + trayectosSimples.add(tt); + PackCamionTren pct = new PackCamionTren(muelleOrigen, puertoOrigen, fechaInicioTrayecto, muelleDestino, puertoDestino, fechaFinTrayecto, trayectosSimples); + r.anyadirTrayecto(pct); } @Test - public final void testAlternarTecho() { - ISO6346 i = new ISO6346("ZRE", 'J', 56731); - Contenedor c = new Contenedor(i, 100, 400, 500, estados.TRANSITO, pesos.KILOS, volumenes.METROS, false); - assertFalse(c.tieneTecho()); - c.alternarTecho(); - assertTrue(c.tieneTecho()); - c.alternarTecho(); - assertFalse(c.tieneTecho()); + public final void testContenedorFlatRack() { + ISO6346 iso = new ISO6346("ZTE", 'J', 458971); + FlatRack fr = new FlatRack(iso, 200, 500, 1000, estados.REGOGIDA, pesos.KILOS, volumenes.METROS); + assertFalse(fr.tieneTecho()); + } + + @Test + public final void testContenedorFlatRackAgregartrayecto() { + ISO6346 iso = new ISO6346("ZTE", 'J', 458971); + FlatRack fr = new FlatRack(iso, 200, 500, 1000, estados.REGOGIDA, pesos.KILOS, volumenes.METROS); + 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); + TBarco tb = new TBarco(muelleDestino,puertoDestino, fechaFinTrayecto,muelleOrigen,puertoOrigen, fechaFinTrayecto); + fr.anyadirTrayecto(tt); + fr.anyadirTrayecto(tb); + } + + @Test (expected = IllegalArgumentException.class) + public final void testContenedorFlatRackAgregartrayectoNulo() { + ISO6346 iso = new ISO6346("ZTE", 'J', 458971); + FlatRack fr = new FlatRack(iso, 200, 500, 1000, estados.REGOGIDA, pesos.KILOS, volumenes.METROS); + fr.anyadirTrayecto(null); + } + + @Test (expected = IllegalArgumentException.class) + public final void testContenedorFlatRackAgregartrayectoCamion() { + ISO6346 iso = new ISO6346("ZTE", 'J', 458971); + FlatRack fr = new FlatRack(iso, 200, 500, 1000, estados.REGOGIDA, pesos.KILOS, volumenes.METROS); + 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); + TCamion tc = new TCamion(muelleOrigen, puertoOrigen, fechaInicioTrayecto, muelleDestino, puertoDestino, fechaFinTrayecto); + fr.anyadirTrayecto(tc); } + @Test (expected = IllegalArgumentException.class) + public final void testContenedorFlatRackAgregartrayectoPackCamionTren() { + ISO6346 iso = new ISO6346("ZTE", 'J', 458971); + FlatRack fr = new FlatRack(iso, 200, 500, 1000, estados.REGOGIDA, pesos.KILOS, volumenes.METROS); + 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); + TCamion tc = new TCamion(muelleOrigen, puertoOrigen, fechaInicioTrayecto, muelleDestino, puertoDestino, fechaFinTrayecto); + TTren tt = new TTren(muelleDestino, puertoDestino, fechaFinTrayecto, muelleOrigen, puertoOrigen, fechaFinTrayecto); + ArrayList<Simple> ts = new ArrayList<>(); + ts.add(tc); + ts.add(tt); + PackCamionTren pct = new PackCamionTren(muelleOrigen,puertoOrigen,fechaInicioTrayecto,muelleOrigen,puertoOrigen,fechaFinTrayecto,ts); + fr.anyadirTrayecto(pct); + } + + @Test (expected = IllegalArgumentException.class) + public final void testContenedorFlatRackAgregartrayectoPackCamionBarco() { + ISO6346 iso = new ISO6346("ZTE", 'J', 458971); + FlatRack fr = new FlatRack(iso, 200, 500, 1000, estados.REGOGIDA, pesos.KILOS, volumenes.METROS); + 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); + TCamion tc = new TCamion(muelleOrigen, puertoOrigen, fechaInicioTrayecto, muelleDestino, puertoDestino, fechaFinTrayecto); + TBarco tb = new TBarco(muelleDestino, puertoDestino, fechaFinTrayecto, muelleOrigen, puertoOrigen, fechaFinTrayecto); + ArrayList<Simple> ts = new ArrayList<>(); + ts.add(tc); + ts.add(tb); + PackCamionBarco pcb = new PackCamionBarco(muelleOrigen,puertoOrigen,fechaInicioTrayecto,muelleOrigen,puertoOrigen,fechaFinTrayecto,ts); + fr.anyadirTrayecto(pcb); + } + + @Test - public void testVolumenEnMetrosCubicos() { + public final void testCambiarEstadoARecogida() { + ISO6346 iso = new ISO6346("ZTE", 'J', 458971); + Estandar e = new Estandar(iso, 200, 500, 1000, estados.TRANSITO, pesos.KILOS, volumenes.METROS, true); + assertFalse(e.contenedorEnRecogida()); + e.cambiarEstadoARecogida(); + assertTrue(e.contenedorEnRecogida()); + } + + @Test + public final void testCambiarEstadoATransito() { + ISO6346 iso = new ISO6346("ZTE", 'J', 458971); + Estandar e = new Estandar(iso, 200, 500, 1000, estados.REGOGIDA, pesos.KILOS, volumenes.METROS, true); + assertFalse(e.contenedorEnTransito()); + e.cambiarEstadoATransito(); + assertTrue(e.contenedorEnTransito()); + } + + @Test + public final void testVolumenEnMetrosCubicos() { ISO6346 i = new ISO6346("ZRE", 'J', 56731); - Contenedor c = new Contenedor(i, 100, 400, 500, estados.TRANSITO, pesos.KILOS, volumenes.METROS, false); + Contenedor c = new Estandar(i, 100, 400, 500, estados.TRANSITO, pesos.KILOS, volumenes.METROS, false); assertEquals(500f, c.volumenEnMetrosCubicos(), 0.01f); ISO6346 i2 = new ISO6346("DRT", 'U', 56731); - Contenedor c2 = new Contenedor(i2, 100, 400, 500, estados.TRANSITO, pesos.KILOS, volumenes.PIES, false); + Contenedor c2 = new Estandar(i2, 100, 400, 500, estados.TRANSITO, pesos.KILOS, volumenes.PIES, false); assertEquals(500 * 0.0283168f, c2.volumenEnMetrosCubicos(), 0.01f); } @Test - public void testVolumenEnPiesCubicos() { + public final void testVolumenEnPiesCubicos() { ISO6346 i = new ISO6346("ZRE", 'J', 56731); - Contenedor c = new Contenedor(i, 100, 400, 500, estados.TRANSITO, pesos.KILOS, volumenes.METROS, false); + Contenedor c = new Estandar(i, 100, 400, 500, estados.TRANSITO, pesos.KILOS, volumenes.METROS, false); assertEquals(500f * 35.3147f, c.volumenEnPiesCubicos(), 0.01f); ISO6346 i2 = new ISO6346("DRT", 'U', 56731); - Contenedor c2 = new Contenedor(i2, 100, 400, 500, estados.TRANSITO, pesos.KILOS, volumenes.PIES, false); + Contenedor c2 = new Estandar(i2, 100, 400, 500, estados.TRANSITO, pesos.KILOS, volumenes.PIES, false); assertEquals(500f, c2.volumenEnPiesCubicos(), 0.001f); } @Test - public void testObtenerPesoKilos() { + public final void testObtenerPesoKilos() { ISO6346 i = new ISO6346("ZRE", 'J', 56731); - Contenedor c = new Contenedor(i, 100, 400, 500, estados.TRANSITO, pesos.KILOS, volumenes.METROS, false); + Contenedor c = new Estandar(i, 100, 400, 500, estados.TRANSITO, pesos.KILOS, volumenes.METROS, false); assertEquals(100f, c.obtenerPesoKilos(), 0.01f); ISO6346 i2 = new ISO6346("DFT", 'J', 589012); - Contenedor c2 = new Contenedor(i2, 100, 400, 500, estados.TRANSITO, pesos.LIBRAS, volumenes.METROS, false); + Contenedor c2 = new Estandar(i2, 100, 400, 500, estados.TRANSITO, pesos.LIBRAS, volumenes.METROS, false); assertEquals(100f *0.453592, c2.obtenerPesoKilos(), 0.01f); } - + @Test - public void testObtenerPesoLibras() { + public final void testObtenerPesoLibras() { ISO6346 i = new ISO6346("ZRE", 'J', 56731); - Contenedor c = new Contenedor(i, 100, 400, 500, estados.TRANSITO, pesos.LIBRAS, volumenes.METROS, false); + Contenedor c = new Estandar(i, 100, 400, 500, estados.TRANSITO, pesos.LIBRAS, volumenes.METROS, false); assertEquals(100f, c.obtenerPesoLibras(), 0.01f); ISO6346 i2 = new ISO6346("DRT", 'U', 56731); - Contenedor c2 = new Contenedor(i2, 100, 400, 500, estados.TRANSITO, pesos.KILOS, volumenes.PIES, false); + Contenedor c2 = new Estandar(i2, 100, 400, 500, estados.TRANSITO, pesos.KILOS, volumenes.PIES, false); assertEquals(100f * 2.20462, c2.obtenerPesoLibras(), 0.01f); + + } + + @Test + public final void testPrecioTransporteTotalContenedor() { + ISO6346 iso = new ISO6346("ZTE", 'J', 458971); + Refrigerado r = new Refrigerado(iso, 200, 500, 1000, estados.REGOGIDA, pesos.KILOS, volumenes.METROS); + 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); + TBarco tb2 = new TBarco(muelleDestino, puertoDestino, fechaFinTrayecto, muelleOrigen, puertoOrigen, fechaFinTrayecto); + r.anyadirTrayecto(tb); + r.anyadirTrayecto(tb2); + assertEquals(r.precioTransporteTotalContenedor(), 48000.0, 0.01f); } @Test - public void testCargaUtilContenedorKilos() { + public final void testPrecioTransporteTotalContenedorSinTrayectos() { + ISO6346 iso = new ISO6346("ZTE", 'J', 458971); + Refrigerado r = new Refrigerado(iso, 200, 500, 1000, estados.REGOGIDA, pesos.KILOS, volumenes.METROS); + assertEquals(r.precioTransporteTotalContenedor(), 0.0, 0.01f); + } + + + @Test + public final void testCargaUtilContenedorKilos() { ISO6346 i = new ISO6346("ZRE", 'J', 56731); - Contenedor c = new Contenedor(i, 100, 400, 500, estados.TRANSITO, pesos.KILOS, volumenes.METROS, false); + Contenedor c = new Estandar(i, 100, 400, 500, estados.TRANSITO, pesos.KILOS, volumenes.METROS, false); assertEquals(400f, c.cargaUtilContenedorKilos(), 0.01f); ISO6346 i2 = new ISO6346("DRT", 'U', 56731); - Contenedor c2 = new Contenedor(i2, 100, 400, 500, estados.TRANSITO, pesos.LIBRAS, volumenes.PIES, false); + Contenedor c2 = new Estandar(i2, 100, 400, 500, estados.TRANSITO, pesos.LIBRAS, volumenes.PIES, false); assertEquals(400f *0.453592, c2.cargaUtilContenedorKilos(), 0.01f); + } - + @Test - public void testCargaUtilContenedorLibras() { + public final void testCargaUtilContenedorLibras() { ISO6346 i = new ISO6346("ZRE", 'J', 56731); - Contenedor c = new Contenedor(i, 100, 400, 500, estados.TRANSITO, pesos.LIBRAS, volumenes.METROS, false); + Contenedor c = new Estandar(i, 100, 400, 500, estados.TRANSITO, pesos.LIBRAS, volumenes.METROS, false); assertEquals(400f, c.cargaUtilContenedorLibras(), 0.01f); ISO6346 i2 = new ISO6346("DRT", 'U', 56731); - Contenedor c2 = new Contenedor(i2, 100, 400, 500, estados.TRANSITO, pesos.KILOS, volumenes.PIES, false); + Contenedor c2 = new Estandar(i2, 100, 400, 500, estados.TRANSITO, pesos.KILOS, volumenes.PIES, false); assertEquals(400f * 2.20462, c2.cargaUtilContenedorLibras(), 0.01f); + } - - + @Test - public void testAnyadirTrayecto() { - Puerto origen = new Puerto("ES" , "BAR"); - Puerto destino = new Puerto("IT" , "NAP"); - Muelle m1 = new Muelle("01", new GPSCoordinate(-3d, 20d), estado.OPERATIVO, 2, 2); - Muelle m2 = new Muelle("01", new GPSCoordinate(10d,10d), estado.OPERATIVO, 2, 2); - Fecha fInicio = new Fecha (25,11,2024); - Fecha fFin = new Fecha(30,11,2024); - origen.anyadirMuelle(m1); - destino.anyadirMuelle(m2); + public final void testGetCodigo() { ISO6346 i = new ISO6346("ZRE", 'J', 56731); - Contenedor c = new Contenedor(i, 100, 400, 500, estados.TRANSITO, pesos.LIBRAS, volumenes.METROS, false); - Trayecto t1 = new Trayecto(m1,origen,fInicio,m2,destino,fFin); - c.anyadirTrayecto(t1); - Muelle m3 = new Muelle("02", new GPSCoordinate(13d,11d), estado.OPERATIVO, 2, 2); - destino.anyadirMuelle(m3); - Trayecto t2 = new Trayecto(m2,destino,fFin,m3,destino,fFin); - c.anyadirTrayecto(t2); + Contenedor c = new Estandar(i, 100, 400, 500, estados.TRANSITO, pesos.LIBRAS, volumenes.METROS, false); + assertEquals(c.getCodigo(), "ZREJ0567310"); } - @Test (expected = IllegalArgumentException.class) - public void testAnyadirTrayectoNulo() { + @Test (expected = IllegalStateException.class) + public final void testanyadirTrayectoFechaInicioAnteriorAUltimoTrayecto() { ISO6346 i = new ISO6346("ZRE", 'J', 56731); - Contenedor c = new Contenedor(i, 100, 400, 500, estados.TRANSITO, pesos.LIBRAS, volumenes.METROS, false); - c.anyadirTrayecto(null); + Estandar e = new Estandar(i, 100, 400, 500, estados.TRANSITO, pesos.LIBRAS, volumenes.METROS, false); + 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); + TBarco tb = new TBarco(muelleDestino,puertoDestino, fechaInicioTrayecto,muelleOrigen,puertoOrigen, fechaFinTrayecto); + e.anyadirTrayecto(tt); + e.anyadirTrayecto(tb); } @Test (expected = IllegalStateException.class) - public void testAnyadirTrayectoFechaInicialAnteriorALaFinalDelUltimo() { - Puerto origen = new Puerto("ES" , "BAR"); - Puerto destino = new Puerto("IT" , "NAP"); - Muelle m1 = new Muelle("01", new GPSCoordinate(-3d, 20d), estado.OPERATIVO, 2, 2); - Muelle m2 = new Muelle("01", new GPSCoordinate(10d,10d), estado.OPERATIVO, 2, 2); - Fecha fInicio = new Fecha (25,11,2024); - Fecha fFin = new Fecha(30,11,2024); - origen.anyadirMuelle(m1); - destino.anyadirMuelle(m2); + public final void testanyadirTrayectoPuertoDestinoYOrigenDistintos() { ISO6346 i = new ISO6346("ZRE", 'J', 56731); - Contenedor c = new Contenedor(i, 100, 400, 500, estados.TRANSITO, pesos.LIBRAS, volumenes.METROS, false); - Trayecto t1 = new Trayecto(m1,origen,fInicio,m2,destino,fFin); - c.anyadirTrayecto(t1); - Muelle m3 = new Muelle("02", new GPSCoordinate(13d,11d), estado.OPERATIVO, 2, 2); - destino.anyadirMuelle(m3); - Fecha fInicioT2 = new Fecha(29,11,2024); - Trayecto t2 = new Trayecto(m2,destino,fInicioT2,m3,destino,fFin); - c.anyadirTrayecto(t2); + Estandar e = new Estandar(i, 100, 400, 500, estados.TRANSITO, pesos.LIBRAS, volumenes.METROS, false); + 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); + TBarco tb = new TBarco(muelleOrigen,puertoOrigen, fechaFinTrayecto, muelleDestino, puertoDestino, fechaFinTrayecto); + e.anyadirTrayecto(tt); + e.anyadirTrayecto(tb); } @Test (expected = IllegalStateException.class) - public void testAnyadirTrayectoPuertosDistintos() { - Puerto origen = new Puerto("ES" , "BAR"); - Puerto destino = new Puerto("IT" , "NAP"); - Muelle m1 = new Muelle("01", new GPSCoordinate(-3d, 20d), estado.OPERATIVO, 2, 2); - Muelle m2 = new Muelle("01", new GPSCoordinate(10d,10d), estado.OPERATIVO, 2, 2); - Fecha fInicio = new Fecha (25,11,2024); - Fecha fFin = new Fecha(30,11,2024); - origen.anyadirMuelle(m1); - destino.anyadirMuelle(m2); + public final void testanyadirTrayectoFechaMuelleOrigenDestinoDistintos() { ISO6346 i = new ISO6346("ZRE", 'J', 56731); - Contenedor c = new Contenedor(i, 100, 400, 500, estados.TRANSITO, pesos.LIBRAS, volumenes.METROS, false); - Trayecto t1 = new Trayecto(m1,origen,fInicio,m2,destino,fFin); - c.anyadirTrayecto(t1); - Muelle m3 = new Muelle("02", new GPSCoordinate(13d,11d), estado.OPERATIVO, 2, 2); - destino.anyadirMuelle(m3); - Trayecto t2 = new Trayecto(m2,origen,fFin,m3,destino,fFin); - c.anyadirTrayecto(t2); + Estandar e = new Estandar(i, 100, 400, 500, estados.TRANSITO, pesos.LIBRAS, volumenes.METROS, false); + 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); + Muelle m2 = new Muelle("05", new GPSCoordinate(12.0, -9.5), estado.OPERATIVO, 10, 3, true, false); + puertoDestino.anyadirMuelle(m2); + TBarco tb = new TBarco(m2, puertoDestino, fechaFinTrayecto, muelleDestino, puertoDestino, fechaFinTrayecto); + e.anyadirTrayecto(tt); + e.anyadirTrayecto(tb); } - @Test (expected = IllegalStateException.class) - public void testAnyadirTrayectoMuellesDistintos() { - Puerto origen = new Puerto("ES" , "BAR"); - Puerto destino = new Puerto("IT" , "NAP"); - Muelle m1 = new Muelle("01", new GPSCoordinate(-3d, 20d), estado.OPERATIVO, 2, 2); - Muelle m2 = new Muelle("01", new GPSCoordinate(10d,10d), estado.OPERATIVO, 2, 2); - Fecha fInicio = new Fecha (25,11,2024); - Fecha fFin = new Fecha(30,11,2024); - origen.anyadirMuelle(m1); - destino.anyadirMuelle(m2); - ISO6346 i = new ISO6346("ZRE", 'J', 56731); - Contenedor c = new Contenedor(i, 100, 400, 500, estados.TRANSITO, pesos.LIBRAS, volumenes.METROS, false); - Trayecto t1 = new Trayecto(m1,origen,fInicio,m2,destino,fFin); - c.anyadirTrayecto(t1); - Muelle m3 = new Muelle("42", new GPSCoordinate(15d,15d), estado.OPERATIVO, 2, 2); - destino.anyadirMuelle(m3); - Trayecto t2 = new Trayecto(m3,destino,fFin,m2,destino,fFin); - c.anyadirTrayecto(t2); - } - - @Test - public void testPrecioTransporteTotalContenedor() { - Puerto origen = new Puerto("ES" , "BAR"); - Puerto destino = new Puerto("IT" , "NAP"); - Muelle m1 = new Muelle("01", new GPSCoordinate(-3d, 20d), estado.OPERATIVO, 2, 2); - Muelle m2 = new Muelle("01", new GPSCoordinate(10d,10d), estado.OPERATIVO, 2, 2); - Fecha fInicio = new Fecha (25,11,2024); - Fecha fFin = new Fecha(30,11,2024); - origen.anyadirMuelle(m1); - destino.anyadirMuelle(m2); + @Test + public final void testTieneTecho() { ISO6346 i = new ISO6346("ZRE", 'J', 56731); - Contenedor c = new Contenedor(i, 100, 400, 500, estados.TRANSITO, pesos.LIBRAS, volumenes.METROS, false); - assertEquals(0.0f, c.precioTransporteTotalContenedor(50f, 0.5f),0.01f); - Trayecto t1 = new Trayecto(m1,origen,fInicio,m2,destino,fFin); - c.anyadirTrayecto(t1); - Muelle m3 = new Muelle("02", new GPSCoordinate(13d,11d), estado.OPERATIVO, 2, 2); - destino.anyadirMuelle(m3); - Trayecto t2 = new Trayecto(m2,destino,fFin,m3,destino,fFin); - c.anyadirTrayecto(t2); - assertEquals(1432.395f, c.precioTransporteTotalContenedor(50f, 0.5f), 0.01f); - } - -} \ No newline at end of file + Estandar e = new Estandar(i, 100, 400, 500, estados.TRANSITO, pesos.LIBRAS, volumenes.METROS, false); + assertFalse(e.tieneTecho()); + } +} diff --git a/uses/es/markse/TrayectoTest.java b/uses/es/markse/TrayectoTest.java index e0a73e6..4df97bd 100644 --- a/uses/es/markse/TrayectoTest.java +++ b/uses/es/markse/TrayectoTest.java @@ -1,271 +1,325 @@ +/** + * + */ package es.markse; import static org.junit.Assert.*; import org.junit.Test; import es.markse.Muelle.estado; import es.uva.inf.poo.maps.GPSCoordinate; + +/** + * Implementacion de los test para la clase abstracta Traycto + * @author javcalv + * @author victorm + * + */ public class TrayectoTest { @Test - public void testTrayecto() { - Puerto p1 = new Puerto("ES" , "BAR"); - Puerto p2 = new Puerto("IT" , "NAP"); - Muelle m1 = new Muelle("12", new GPSCoordinate(-3d, 20d), estado.OPERATIVO, 2, 2); - Muelle m2 = new Muelle("34", new GPSCoordinate(10d,10d), estado.OPERATIVO, 2, 2); - Fecha f1 = new Fecha (25,11,2024); - Fecha f2 = new Fecha(30,11,2024); - p1.anyadirMuelle(m1); - p2.anyadirMuelle(m2); - Trayecto t = new Trayecto(m1,p1,f1,m2,p2,f2); - assertEquals(m1,t.getMuelleOrigen()); - assertEquals(p1,t.getPuertoOrigen()); - assertEquals(f1,t.getFechaInicioTrayecto()); - assertEquals(m2,t.getMuelleDestino()); - assertEquals(p2,t.getPuertoDestino()); - assertEquals(f2,t.getFechaFinTrayecto()); + public final void testTrayecto() { + 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.getMuelleOrigen().getIdentificador(), "01"); + assertTrue(tt.getMuelleDestino().estaOperativo()); } @Test (expected = IllegalArgumentException.class) - public void testTrayectoMuelleOrigenNulo() { - Puerto p1 = new Puerto("ES" , "BAR"); - Puerto p2 = new Puerto("IT" , "NAP"); - Muelle m2 = new Muelle("34", new GPSCoordinate(10d,10d), estado.OPERATIVO, 2, 2); - Fecha f1 = new Fecha (25,11,2024); - Fecha f2 = new Fecha(30,11,2024); - p2.anyadirMuelle(m2); - new Trayecto(null,p1,f1,m2,p2,f2); + public final void testTrayectoMuelleOrigenNulo() { + 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"); + puertoDestino.anyadirMuelle(muelleDestino); + Fecha fechaInicioTrayecto = new Fecha(20, 10, 2015); + Fecha fechaFinTrayecto = new Fecha(30, 10, 2015); + new TTren(null, puertoOrigen, fechaInicioTrayecto, muelleDestino, puertoDestino, fechaFinTrayecto); } @Test (expected = IllegalArgumentException.class) - public void testTrayectoMuelleDestinoNulo() { - Puerto p1 = new Puerto("ES" , "BAR"); - Puerto p2 = new Puerto("IT" , "NAP"); - Muelle m1 = new Muelle("12", new GPSCoordinate(-3d, 20d), estado.OPERATIVO, 2, 2); - Fecha f1 = new Fecha (25,11,2024); - Fecha f2 = new Fecha(30,11,2024); - p1.anyadirMuelle(m1); - new Trayecto(m1,p1,f1,null,p2,f2); + public final void testTrayectoMuelleDestinoNulo() { + Muelle muelleOrigen = new Muelle("01", new GPSCoordinate(10.0, 15.0), estado.OPERATIVO, 10, 3, true, false); + Puerto puertoOrigen = new Puerto("ES", "BAR"); + Puerto puertoDestino = new Puerto("ES", "VAL"); + puertoOrigen.anyadirMuelle(muelleOrigen); + Fecha fechaInicioTrayecto = new Fecha(20, 10, 2015); + Fecha fechaFinTrayecto = new Fecha(30, 10, 2015); + new TBarco(muelleOrigen, puertoOrigen, fechaInicioTrayecto, null, puertoDestino, fechaFinTrayecto); } @Test (expected = IllegalArgumentException.class) - public void testTrayectoPuertoOrigenNulo() { - Puerto p2 = new Puerto("IT" , "NAP"); - Muelle m1 = new Muelle("12", new GPSCoordinate(-3d, 20d), estado.OPERATIVO, 2, 2); - Muelle m2 = new Muelle("34", new GPSCoordinate(10d,10d), estado.OPERATIVO, 2, 2); - Fecha f1 = new Fecha (25,11,2024); - Fecha f2 = new Fecha(30,11,2024); - new Trayecto(m1,null,f1,m2,p2,f2); + public final void testTrayectoPuertoOrigenNulo() { + 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 puertoDestino = new Puerto("ES", "VAL"); + puertoDestino.anyadirMuelle(muelleDestino); + Fecha fechaInicioTrayecto = new Fecha(20, 10, 2015); + Fecha fechaFinTrayecto = new Fecha(30, 10, 2015); + new TTren(muelleOrigen, null, fechaInicioTrayecto, muelleDestino, puertoDestino, fechaFinTrayecto); } - + @Test (expected = IllegalArgumentException.class) - public void testTrayectoPuertoDestinoNulo() { - Puerto p1 = new Puerto("ES" , "BAR"); - Muelle m1 = new Muelle("12", new GPSCoordinate(-3d, 20d), estado.OPERATIVO, 2, 2); - Muelle m2 = new Muelle("34", new GPSCoordinate(10d,10d), estado.OPERATIVO, 2, 2); - Fecha f1 = new Fecha (25,11,2024); - Fecha f2 = new Fecha(30,11,2024); - new Trayecto(m1,p1,f1,m2,null,f2); + public final void testTrayectoPuertoDestinoNulo() { + 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"); + puertoOrigen.anyadirMuelle(muelleOrigen); + Fecha fechaInicioTrayecto = new Fecha(20, 10, 2015); + Fecha fechaFinTrayecto = new Fecha(30, 10, 2015); + new TTren(muelleOrigen, puertoOrigen, fechaInicioTrayecto, muelleDestino, null, fechaFinTrayecto); + } @Test (expected = IllegalArgumentException.class) - public void testTrayectoFechaOrigenNulo() { - Puerto p1 = new Puerto("ES" , "BAR"); - Puerto p2 = new Puerto("IT" , "NAP"); - Muelle m1 = new Muelle("12", new GPSCoordinate(-3d, 20d), estado.OPERATIVO, 2, 2); - Muelle m2 = new Muelle("34", new GPSCoordinate(10d,10d), estado.OPERATIVO, 2, 2); - Fecha f2 = new Fecha(30,11,2024); - new Trayecto(m1,p1,null,m2,p2,f2); + public final void testTrayectoFechaInicioNula() { + 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 fechaFinTrayecto = new Fecha(30, 10, 2015); + new TTren(muelleOrigen, puertoOrigen, null, muelleDestino, puertoDestino, fechaFinTrayecto); } @Test (expected = IllegalArgumentException.class) - public void testTrayectoFechaFinNulo() { - Puerto p1 = new Puerto("ES" , "BAR"); - Puerto p2 = new Puerto("IT" , "NAP"); - Muelle m1 = new Muelle("12", new GPSCoordinate(-3d, 20d), estado.OPERATIVO, 2, 2); - Muelle m2 = new Muelle("34", new GPSCoordinate(10d,10d), estado.OPERATIVO, 2, 2); - Fecha f1 = new Fecha (25,11,2024); - new Trayecto(m1,p1,f1,m2,p2,null); + public final void testTrayectoFechaFinNula() { + 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); + new TTren(muelleOrigen, puertoOrigen, fechaInicioTrayecto, muelleDestino, puertoDestino, null); } @Test (expected = IllegalStateException.class) - public void testTrayectoMuelleOrigenFueraDeServicio() { - Puerto p1 = new Puerto("ES" , "BAR"); - Puerto p2 = new Puerto("IT" , "NAP"); - Muelle m1 = new Muelle("12", new GPSCoordinate(-3d, 20d), estado.FUERA_DE_SERVICIO, 2, 2); - Muelle m2 = new Muelle("34", new GPSCoordinate(10d,10d), estado.OPERATIVO, 2, 2); - Fecha f1 = new Fecha (25,11,2024); - Fecha f2 = new Fecha(30,11,2024); - new Trayecto(m1,p1,f1,m2,p2,f2); + public final void testTrayectoMuelleOrigenFueraServicio() { + Muelle muelleOrigen = new Muelle("01", new GPSCoordinate(10.0, 15.0), estado.FUERA_DE_SERVICIO, 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); + new TTren(muelleOrigen, puertoOrigen, fechaInicioTrayecto, muelleDestino, puertoDestino, fechaFinTrayecto); } @Test (expected = IllegalStateException.class) - public void testTrayectoMuelleDestinoFueraDeServicio() { - Puerto p1 = new Puerto("ES" , "BAR"); - Puerto p2 = new Puerto("IT" , "NAP"); - Muelle m1 = new Muelle("12", new GPSCoordinate(-3d, 20d), estado.OPERATIVO, 2, 2); - Muelle m2 = new Muelle("34", new GPSCoordinate(10d,10d), estado.FUERA_DE_SERVICIO, 2, 2); - Fecha f1 = new Fecha (25,11,2024); - Fecha f2 = new Fecha(30,11,2024); - new Trayecto(m1,p1,f1,m2,p2,f2); + public final void testTrayectoMuelleDestinoFueraServicio() { + 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.FUERA_DE_SERVICIO, 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 testTrayectoMuelleOrigenNoEstaEnPuerto() { - Puerto p1 = new Puerto("ES" , "BAR"); - Puerto p2 = new Puerto("IT" , "NAP"); - Muelle m1 = new Muelle("12", new GPSCoordinate(-3d, 20d), estado.OPERATIVO, 2, 2); - Muelle m2 = new Muelle("34", new GPSCoordinate(10d,10d), estado.OPERATIVO, 2, 2); - Fecha f1 = new Fecha (25,11,2024); - Fecha f2 = new Fecha(30,11,2024); - p2.anyadirMuelle(m2); - new Trayecto(m1,p1,f1,m2,p2,f2); + public final void testTrayectoMuelleOrigenNoPerteneceAPuerto() { + 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"); + 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 testTrayectoMuelleDestinoNoEstaEnPuerto() { - Puerto p1 = new Puerto("ES" , "BAR"); - Puerto p2 = new Puerto("IT" , "NAP"); - Muelle m1 = new Muelle("12", new GPSCoordinate(-3d, 20d), estado.OPERATIVO, 2, 2); - Muelle m2 = new Muelle("34", new GPSCoordinate(10d,10d), estado.OPERATIVO, 2, 2); - Fecha f1 = new Fecha (25,11,2024); - Fecha f2 = new Fecha(30,11,2024); - p1.anyadirMuelle(m1); - new Trayecto(m1,p1,f1,m2,p2,f2); + public final void testTrayectoMuelleDestinoNoPerteneceAPuerto() { + 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); + Fecha fechaInicioTrayecto = new Fecha(20, 10, 2015); + Fecha fechaFinTrayecto = new Fecha(30, 10, 2015); + new TTren(muelleOrigen, puertoOrigen, fechaInicioTrayecto, muelleDestino, puertoDestino, fechaFinTrayecto); } @Test (expected = IllegalArgumentException.class) - public void testTrayectoMuellesIguales() { - Puerto p1 = new Puerto("ES" , "BAR"); - Muelle m1 = new Muelle("12", new GPSCoordinate(-3d, 20d), estado.OPERATIVO, 2, 2); - Fecha f1 = new Fecha (25,11,2024); - Fecha f2 = new Fecha(30,11,2024); - p1.anyadirMuelle(m1); - new Trayecto(m1,p1,f1,m1,p1,f2); + public final void testTrayectoFechaFinAnteriorAFechaInicio() { + 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); + new TTren(muelleOrigen, puertoOrigen, fechaFinTrayecto, muelleDestino, puertoDestino, fechaInicioTrayecto); } + @Test - public void testTrayectoMuellesIgualesPeroPuertosNo() { - Puerto p1 = new Puerto("ES" , "BAR"); - Puerto p2 = new Puerto("IT" , "NAP"); - Muelle m1 = new Muelle("12", new GPSCoordinate(-3d, 20d), estado.OPERATIVO, 2, 2); - Muelle m2 = new Muelle("12", new GPSCoordinate(10d,10d), estado.OPERATIVO, 2, 2); - Fecha f1 = new Fecha (25,11,2024); - Fecha f2 = new Fecha(30,11,2024); - p1.anyadirMuelle(m1); - p2.anyadirMuelle(m2); - new Trayecto(m1,p1,f1,m2,p2,f2); + public final void testFechaFinTrayectoSuperior() { + 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); + boolean b = tt.FechaFinTrayectoSuperior(new Fecha(25,10,2015)); + boolean b2 = tt.FechaFinTrayectoSuperior(new Fecha(10,11,2015)); + assertFalse(b); + assertTrue(b2); } @Test (expected = IllegalArgumentException.class) - public void testFechaInicioPosteriorAFin() { - Puerto p1 = new Puerto("ES" , "BAR"); - Puerto p2 = new Puerto("IT" , "NAP"); - Muelle m1 = new Muelle("12", new GPSCoordinate(-3d, 20d), estado.OPERATIVO, 2, 2); - Muelle m2 = new Muelle("34", new GPSCoordinate(10d,10d), estado.OPERATIVO, 2, 2); - Fecha f1 = new Fecha (25,11,2024); - Fecha f2 = new Fecha(30,11,2024); - p1.anyadirMuelle(m1); - p2.anyadirMuelle(m2); - new Trayecto(m1,p1,f2,m2,p2,f1); + public final void testFechaFinTrayectoSuperiorNulo() { + 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); + tt.FechaFinTrayectoSuperior(null); } + @Test - public void testFechaFinTrayectoSuperiorTrue() { - Puerto p1 = new Puerto("ES" , "BAR"); - Puerto p2 = new Puerto("IT" , "NAP"); - Muelle m1 = new Muelle("12", new GPSCoordinate(-3d, 20d), estado.OPERATIVO, 2, 2); - Muelle m2 = new Muelle("34", new GPSCoordinate(10d,10d), estado.OPERATIVO, 2, 2); - Fecha f1 = new Fecha (25,11,2024); - Fecha f2 = new Fecha(30,11,2024); - p1.anyadirMuelle(m1); - p2.anyadirMuelle(m2); - Trayecto t = new Trayecto(m1,p1,f1,m2,p2,f2); - Fecha fecha = new Fecha(03,12,2024); - assertTrue(t.FechaFinTrayectoSuperior(fecha)); + public final void testPrecioTrayectoEnEuros() { + 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.precioTrayectoEnEuros(), 76520.91, 0.01f); } - + @Test - public void testFechaFinTrayectoSuperiorFalse() { - Puerto p1 = new Puerto("ES" , "BAR"); - Puerto p2 = new Puerto("IT" , "NAP"); - Muelle m1 = new Muelle("12", new GPSCoordinate(-3d, 20d), estado.OPERATIVO, 2, 2); - Muelle m2 = new Muelle("34", new GPSCoordinate(10d,10d), estado.OPERATIVO, 2, 2); - Fecha f1 = new Fecha (25,11,2024); - Fecha f2 = new Fecha(30,11,2024); - p1.anyadirMuelle(m1); - p2.anyadirMuelle(m2); - Trayecto t = new Trayecto(m1,p1,f1,m2,p2,f2); - assertFalse(t.FechaFinTrayectoSuperior(f1)); + public final void testInforTrayecto() { + 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); + String s = tt.inforTrayecto(); + assertEquals(s, tt.inforTrayecto()); } - - @Test (expected = IllegalArgumentException.class) - public void testFechaFinTrayectoSuperiorNula() { - Puerto p1 = new Puerto("ES" , "BAR"); - Puerto p2 = new Puerto("IT" , "NAP"); - Muelle m1 = new Muelle("12", new GPSCoordinate(-3d, 20d), estado.OPERATIVO, 2, 2); - Muelle m2 = new Muelle("34", new GPSCoordinate(10d,10d), estado.OPERATIVO, 2, 2); - Fecha f1 = new Fecha (25,11,2024); - Fecha f2 = new Fecha(30,11,2024); - p1.anyadirMuelle(m1); - p2.anyadirMuelle(m2); - Trayecto t = new Trayecto(m1,p1,f1,m2,p2,f2); - assertFalse(t.FechaFinTrayectoSuperior(null)); + + @Test + public final void testNumeroDeDiasDeTrayecto() { + 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.numeroDeDiasDeTrayecto(), 11); } - + @Test - public void testPrecioTransporeEuros() { - Puerto p1 = new Puerto("ES" , "BAR"); - Puerto p2 = new Puerto("IT" , "NAP"); - Muelle m1 = new Muelle("12", new GPSCoordinate(0d, 0d), estado.OPERATIVO, 2, 2); - Muelle m2 = new Muelle("34", new GPSCoordinate(10d,10d), estado.OPERATIVO, 2, 2); - Fecha f1 = new Fecha (25,11,2024); - Fecha f2 = new Fecha(30,11,2024); - p1.anyadirMuelle(m1); - p2.anyadirMuelle(m2); - Trayecto t = new Trayecto(m1,p1,f1,m2,p2,f2); - assertEquals(1865.1090f, t.precioTrayectoEnEuros(50f, 1f), 0.01f); + public final void testGetMuelleOrigen() { + 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.getMuelleOrigen(), muelleOrigen); } - - @Test (expected = IllegalArgumentException.class) - public void testPrecioTransporeEurosCosteDiarioNegativo() { - Puerto p1 = new Puerto("ES" , "BAR"); - Puerto p2 = new Puerto("IT" , "NAP"); - Muelle m1 = new Muelle("12", new GPSCoordinate(0d, 0d), estado.OPERATIVO, 2, 2); - Muelle m2 = new Muelle("34", new GPSCoordinate(10d,10d), estado.OPERATIVO, 2, 2); - Fecha f1 = new Fecha (25,11,2024); - Fecha f2 = new Fecha(30,11,2024); - p1.anyadirMuelle(m1); - p2.anyadirMuelle(m2); - Trayecto t = new Trayecto(m1,p1,f1,m2,p2,f2); - t.precioTrayectoEnEuros(-5f, 1f); + + @Test + public final void testGetMuelleDestino() { + 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(), muelleDestino); } - - @Test (expected = IllegalArgumentException.class) - public void testPrecioTransporeEurosCosteMillaNegativo() { - Puerto p1 = new Puerto("ES" , "BAR"); - Puerto p2 = new Puerto("IT" , "NAP"); - Muelle m1 = new Muelle("12", new GPSCoordinate(0d, 0d), estado.OPERATIVO, 2, 2); - Muelle m2 = new Muelle("34", new GPSCoordinate(10d,10d), estado.OPERATIVO, 2, 2); - Fecha f1 = new Fecha (25,11,2024); - Fecha f2 = new Fecha(30,11,2024); - p1.anyadirMuelle(m1); - p2.anyadirMuelle(m2); - Trayecto t = new Trayecto(m1,p1,f1,m2,p2,f2); - t.precioTrayectoEnEuros(50f, -1f); + + @Test + public final void testGetPuertoOrigen() { + 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.getPuertoOrigen(), puertoOrigen); } - + + @Test + public final void testGetPuertoDestino() { + 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.getPuertoDestino(), puertoDestino); + } + + @Test + public final void testGetFechaInicioTrayecto() { + 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.getFechaInicioTrayecto(), fechaInicioTrayecto); + } + @Test - public void testInforTrayceto() { - Puerto p1 = new Puerto("ES" , "BAR"); - Puerto p2 = new Puerto("IT" , "NAP"); - Muelle m1 = new Muelle("12", new GPSCoordinate(0d, 0d), estado.OPERATIVO, 2, 2); - Muelle m2 = new Muelle("34", new GPSCoordinate(10d,10d), estado.OPERATIVO, 2, 2); - Fecha f1 = new Fecha (25,11,2024); - Fecha f2 = new Fecha(30,11,2024); - p1.anyadirMuelle(m1); - p2.anyadirMuelle(m2); - Trayecto t = new Trayecto(m1,p1,f1,m2,p2,f2); - String str = t.inforTrayecto(); - assertEquals(str, t.inforTrayecto()); + public final void testGetFechaFinTrayecto() { + 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.getFechaFinTrayecto(), fechaFinTrayecto); } } \ No newline at end of file -- GitLab