Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Alvaro Ordóñez Romero
/
DAE-aha00026-aor00039
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
33ac8c2f
authored
Nov 08, 2023
by
Alvaro Ordóñez Romero
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Adición de application-test.properties y modificacion ReservaRepositoryTest
parent
82df451c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
2 deletions
src/main/resources/application-test.properties
src/main/resources/application.properties
src/test/java/com/carpooling/carpoolingaoraha/repositorios/ReservaRepositoryTest.java
src/main/resources/application-test.properties
0 → 100644
View file @
33ac8c2f
# 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
# ...
src/main/resources/application.properties
View file @
33ac8c2f
...
...
@@ -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
src/test/java/com/carpooling/carpoolingaoraha/repositorios/ReservaRepositoryTest.java
View file @
33ac8c2f
...
...
@@ -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
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment