Cambios menores

parent 8ca2e0e6
...@@ -52,7 +52,7 @@ public class GestorPrestamosTest { ...@@ -52,7 +52,7 @@ public class GestorPrestamosTest {
public void testRegistrarFechaDevolucionPrestamoIdIgualZero() { public void testRegistrarFechaDevolucionPrestamoIdIgualZero() {
GestorPrestamos gestorPrestamos = new GestorPrestamos(); GestorPrestamos gestorPrestamos = new GestorPrestamos();
String mensajeConfirmacion = gestorPrestamos.registrarFechaDevolucion(-1, LocalDate.of(2022, Month.DECEMBER, 26)); String mensajeConfirmacion = gestorPrestamos.registrarFechaDevolucion(0, LocalDate.of(2022, Month.DECEMBER, 26));
Assertions.assertThat(mensajeConfirmacion).isEqualTo("ID del préstamo debe ser superior a 0"); Assertions.assertThat(mensajeConfirmacion).isEqualTo("ID del préstamo debe ser superior a 0");
} }
...@@ -71,6 +71,19 @@ public class GestorPrestamosTest { ...@@ -71,6 +71,19 @@ public class GestorPrestamosTest {
} }
@Test @Test
public void testRegistrarFechaDevolucionFechaDevolucionIgualFechaTope() {
GestorPrestamos gestorPrestamos = new GestorPrestamos();
Prestamo prestamo = new Prestamo(1, LocalDate.of(2022, Month.DECEMBER, 30), LocalDate.of(2023, Month.JANUARY, 3));
gestorPrestamos.crearPrestamo(prestamo);
String mensajeConfirmacion = gestorPrestamos.registrarFechaDevolucion(1, LocalDate.of(2023, Month.JANUARY, 3));
Assertions.assertThat(mensajeConfirmacion).isEqualTo("Fecha de devolución registrada");
}
@Test
public void testRegistrarFechaDevolucionFechaDevolucionPasada() { public void testRegistrarFechaDevolucionFechaDevolucionPasada() {
GestorPrestamos gestorPrestamos = new GestorPrestamos(); GestorPrestamos gestorPrestamos = new GestorPrestamos();
...@@ -82,5 +95,18 @@ public class GestorPrestamosTest { ...@@ -82,5 +95,18 @@ public class GestorPrestamosTest {
Assertions.assertThat(mensajeConfirmacion).isEqualTo("La fecha introducida debe ser actual o futura"); Assertions.assertThat(mensajeConfirmacion).isEqualTo("La fecha introducida debe ser actual o futura");
} }
@Test
public void testRegistrarFechaDevolucionFechaDevolucionFutura() {
GestorPrestamos gestorPrestamos = new GestorPrestamos();
Prestamo prestamo = new Prestamo(1, LocalDate.of(2022, Month.DECEMBER, 30), LocalDate.of(2023, Month.JANUARY, 3));
gestorPrestamos.crearPrestamo(prestamo);
String mensajeConfirmacion = gestorPrestamos.registrarFechaDevolucion(1, LocalDate.of(2023, Month.DECEMBER, 2));
Assertions.assertThat(mensajeConfirmacion).isEqualTo("La fecha introducida debe ser actual o futura");
}
} }
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