Commit deba9716 by Antonio Rueda

Comprobación de que sólo la dirección puede crear hoteles.

parent ab7828b7
package es.ujaen.dae.reservahoteles.excepciones;
/**
*
* @author ajrueda
*/
public class OperacionDeDireccion extends RuntimeException {
}
package es.ujaen.dae.reservahoteles.servicios;
import es.ujaen.dae.reservahoteles.excepciones.OperacionDeDireccion;
import es.ujaen.dae.reservahoteles.entidades.Cliente;
import es.ujaen.dae.reservahoteles.entidades.Hotel;
import es.ujaen.dae.reservahoteles.entidades.Reserva;
......@@ -40,6 +41,9 @@ public class ServicioReservas {
}
public void nuevoHotel(Cliente direccion, @Valid Hotel hotel) {
if (!direccion.email().equals("direccion"))
throw new OperacionDeDireccion();
hoteles.put(hotel.id(), hotel);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment