Adición de application-test.properties y modificacion ReservaRepositoryTest

parent 82df451c
# Configuración de la base de datos para pruebas en MySQL
spring.datasource.url=jdbc:mysql://localhost:3306/aha00026aor00039
spring.datasource.username=root
spring.datasource.password=root
spring.datasource.driverClassName=com.mysql.cj.jdbc.Driver
spring.jpa.hibernate.ddl-auto=create-drop
# Otros ajustes de configuración específicos para pruebas
# ...
......@@ -2,3 +2,4 @@ spring.datasource.url=jdbc:mysql://localhost:3306/aha00026aor00039
spring.datasource.username=root
spring.datasource.password=root
spring.jpa.hibernate.ddl-auto=update
spring.profiles.active=test
......@@ -2,7 +2,7 @@ package com.carpooling.carpoolingaoraha.repositorios;
import com.carpooling.carpoolingaoraha.entidades.Reserva;
import com.carpooling.carpoolingaoraha.entidades.Usuario;
import org.springframework.transaction.annotation.Transactional;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
......@@ -10,6 +10,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.jdbc.AutoConfigureTestDatabase;
import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.transaction.annotation.Propagation;
@RunWith(SpringRunner.class)
@DataJpaTest
......@@ -20,7 +21,8 @@ public class ReservaRepositoryTest {
private ReservaRepository repositorio;
@Test
public void testInsertUsuario(){
@Transactional(propagation = Propagation.NOT_SUPPORTED)
public void testInsertReserva(){
Reserva reserva = new Reserva();
reserva.setNumPasajeros(2);
reserva.setIdReserva(1);
......
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