Changes by Álvaro Ordoñez colabora en el anterior commit

parent 890265ca
...@@ -24,14 +24,20 @@ public class UsuarioTest { ...@@ -24,14 +24,20 @@ public class UsuarioTest {
@Test @Test
public void testOfrecerViaje() { public void testOfrecerViaje() {
// Configuración inicial
SistemaCarPooling sis = new SistemaCarPooling(); SistemaCarPooling sis = new SistemaCarPooling();
Usuario conductor = new Usuario("Conductor", "ApellidoConductor", new Date(), "12345678A", 123456789, "conductor@example.com", "clave", CONDUCTOR, sis); Usuario conductor = new Usuario("Conductor", "ApellidoConductor", new Date(), "12345678A", 123456789, "conductor@example.com", "clave", CONDUCTOR, sis);
Usuario pasajero = new Usuario("Pasajero", "ApellidoPasajero", new Date(), "87654321B", 987654321, "pasajero@example.com", "clave", Rol.PASAJERO, sis);
assertTrue(conductor.ofrecerViaje("Origen", "Destino", new Date(), 3, 20)); // Acción: Intentar ofrecer un viaje
boolean exito = conductor.ofrecerViaje("Origen", "Destino", new Date(), 3, 20);
// Aserciones y mensajes descriptivos
assertTrue(exito, "El conductor debería poder ofrecer un viaje");
assertTrue(conductor.getViajesOfertados().contains(1), "La lista de viajes ofertados debería contener la nueva reserva"); // Asegúrate de ajustar el índice si es necesario
assertEquals(1, conductor.getViajesOfertados().size());
} }
@Test @Test
public void testAsignarPuntuacion() { public void testAsignarPuntuacion() {
SistemaCarPooling sis = new SistemaCarPooling(); SistemaCarPooling sis = new SistemaCarPooling();
......
...@@ -11,7 +11,7 @@ public class ViajeTest { ...@@ -11,7 +11,7 @@ public class ViajeTest {
private Viaje viaje; private Viaje viaje;
@Before @Before
public void testConstructor() { public void setUp() {
viaje = new Viaje("Origen", "Destino", new Date(), 3, 20, 5); viaje = new Viaje("Origen", "Destino", new Date(), 3, 20, 5);
} }
......
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